~fabrixxm/activist

d8340d5fbede25051b38997d2c9389d1ea82d647 — fabrixxm 2 months ago 4a671f6
sqlbuilder: add 'avec()'

I can't use 'with()'....
1 files changed, 7 insertions(+), 0 deletions(-)

M activist/db/sqlbuilder.py
M activist/db/sqlbuilder.py => activist/db/sqlbuilder.py +7 -0
@@ 123,6 123,13 @@ class Query(QueryBase):
        for k, v in kwargs.items():
            self.tables.append(_Table(name=k, alias=v))

    def avec(self, **kwargs) -> Self:
        for k,v in kwargs.items():
            self.data['WITH'].append(f"k as ({v})")
            if isinstance(v, QueryBase):
                self.parameters += v.parameters
        return self

    def select(self, *args, **kwargs) -> Self:
        """
            SELECT