Build the query string without executing Returns the constructed GQL query as a string.
(self)
| 94 | return self |
| 95 | |
| 96 | def build(self) -> str: |
| 97 | ''' |
| 98 | Build the query string without executing |
| 99 | Returns the constructed GQL query as a string. |
| 100 | ''' |
| 101 | query = "" |
| 102 | |
| 103 | # MATCH clauses |
| 104 | for pattern in self._match_patterns: |
| 105 | if query: |
| 106 | query += " " |
| 107 | query += "MATCH " |
| 108 | query += pattern |
| 109 | |
| 110 | # WHERE clauses |
| 111 | if self._where_clauses: |
| 112 | query += " WHERE " |
| 113 | query += " AND ".join(self._where_clauses) |
| 114 | |
| 115 | # WITH clauses |
| 116 | for clause in self._with_clauses: |
| 117 | query += " WITH " |
| 118 | query += clause |
| 119 | |
| 120 | # RETURN clause |
| 121 | if self._return_clause: |
| 122 | query += " RETURN " |
| 123 | query += self._return_clause |
| 124 | |
| 125 | # ORDER BY clause |
| 126 | if self._order_by: |
| 127 | query += " ORDER BY " |
| 128 | query += self._order_by |
| 129 | |
| 130 | # SKIP clause |
| 131 | if self._skip is not None: |
| 132 | query += " SKIP " |
| 133 | query += str(self._skip) |
| 134 | |
| 135 | # LIMIT clause |
| 136 | if self._limit is not None: |
| 137 | query += " LIMIT " |
| 138 | query += str(self._limit) |
| 139 | |
| 140 | return query.strip() |
| 141 | |
| 142 | def execute(self): |
| 143 | ''' |