Taking in a Query object with some attributes set, return a string representation of the query in the correct dialect. This is just another dispatch destination of self._write(). When self._write(Query) is called, that's dispatched to self._write_query(Query)
(self, query)
| 105 | return sql |
| 106 | |
| 107 | def _write_query(self, query): |
| 108 | """ |
| 109 | Taking in a Query object with some attributes set, return a string |
| 110 | representation of the query in the correct dialect. |
| 111 | |
| 112 | This is just another dispatch destination of self._write(). When |
| 113 | self._write(Query) is called, that's dispatched to self._write_query(Query) |
| 114 | """ |
| 115 | sql = list() |
| 116 | # Write out each section in the proper order |
| 117 | for clause in ( |
| 118 | query.with_clause, |
| 119 | query.select_clause, |
| 120 | query.from_clause, |
| 121 | query.where_clause, |
| 122 | query.group_by_clause, |
| 123 | query.having_clause, |
| 124 | query.union_clause, |
| 125 | query.order_by_clause, |
| 126 | query.limit_clause |
| 127 | ): |
| 128 | if clause: |
| 129 | sql.append(self._write(clause)) |
| 130 | sql = '\n'.join(sql) |
| 131 | return sql |
| 132 | |
| 133 | def _write_insert_statement(self, insert_statement): |
| 134 | """ |