Represents the entries in a WITH clause. These are very similar to InlineViews but may have an additional alias. Ex: WITH bar AS (SELECT * FROM foo) SELECT * FROM bar as r JOIN (SELECT * FROM baz) AS z ON ... The WithClauseInlineView has aliases "bar"
| 536 | |
| 537 | |
| 538 | class WithClauseInlineView(InlineView): |
| 539 | '''Represents the entries in a WITH clause. These are very similar to InlineViews but |
| 540 | may have an additional alias. |
| 541 | |
| 542 | Ex: WITH bar AS (SELECT * FROM foo) |
| 543 | SELECT * |
| 544 | FROM bar as r |
| 545 | JOIN (SELECT * FROM baz) AS z ON ... |
| 546 | |
| 547 | The WithClauseInlineView has aliases "bar" and "r" while the InlineView has |
| 548 | only the alias "z". |
| 549 | |
| 550 | ''' |
| 551 | |
| 552 | def __init__(self, query, with_clause_alias): |
| 553 | self.query = query |
| 554 | self.with_clause_alias = with_clause_alias |
| 555 | self.alias = None |
| 556 | |
| 557 | @property |
| 558 | def identifier(self): |
| 559 | return self.alias or self.with_clause_alias |
| 560 | |
| 561 | def __deepcopy__(self, memo): |
| 562 | other = WithClauseInlineView(deepcopy(self.query, memo), self.with_clause_alias) |
| 563 | other.alias = self.alias |
| 564 | return other |
| 565 | |
| 566 | |
| 567 | class JoinClause(object): |
no outgoing calls
no test coverage detected