Represents an inline view. Ex: In the query "SELECT * FROM (SELECT * FROM foo) AS bar", "(SELECT * FROM foo) AS bar" would be an inline view.
| 481 | |
| 482 | |
| 483 | class InlineView(TableExpr): |
| 484 | '''Represents an inline view. |
| 485 | |
| 486 | Ex: In the query "SELECT * FROM (SELECT * FROM foo) AS bar", |
| 487 | "(SELECT * FROM foo) AS bar" would be an inline view. |
| 488 | |
| 489 | ''' |
| 490 | |
| 491 | def __init__(self, query): |
| 492 | self.query = query |
| 493 | self.alias = None |
| 494 | self.is_visible = True |
| 495 | |
| 496 | @property |
| 497 | def identifier(self): |
| 498 | return self.alias |
| 499 | |
| 500 | @property |
| 501 | def cols(self): |
| 502 | return ValExprList(Column(self, item.name, item.type) for item in |
| 503 | self.query.select_clause.items) |
| 504 | |
| 505 | @property |
| 506 | def collections(self): |
| 507 | return [] |
| 508 | |
| 509 | def __repr__(self): |
| 510 | return '%s<%s>' % (type(self).__name__, ', '.join(repr(col) for col in self.cols)) |
| 511 | |
| 512 | def __deepcopy__(self, memo): |
| 513 | other = InlineView(deepcopy(self.query, memo)) |
| 514 | other.alias = self.alias |
| 515 | other.is_visible = self.is_visible |
| 516 | return other |
| 517 | |
| 518 | |
| 519 | class WithClause(object): |
no outgoing calls
no test coverage detected