Skip to content

Commit

Permalink
Factor star into its own node class
Browse files Browse the repository at this point in the history
  • Loading branch information
coleifer committed Oct 20, 2023
1 parent f400b68 commit 8e539de
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion peewee.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,13 @@ def __get__(self, instance, instance_type=None):
return self


class Star(Node):
def __init__(self, source):
self.source = source
def __sql__(self, ctx):
return ctx.sql(QualifiedNames(self.source)).literal('.*')


class Source(Node):
c = _DynamicColumn()

Expand All @@ -798,7 +805,7 @@ def select(self, *columns):

@property
def __star__(self):
return NodeList((QualifiedNames(self), SQL('.*')), glue='')
return Star(self)

def join(self, dest, join_type=JOIN.INNER, on=None):
return Join(self, dest, join_type, on)
Expand Down

0 comments on commit 8e539de

Please sign in to comment.