Python sqlalchemy.select._distinct() Examples

The following are 9 code examples of sqlalchemy.select._distinct(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sqlalchemy.select , or try the search function .
Example #1
Source File: base.py    From sqlalchemy with MIT License 6 votes vote down vote up
def get_select_precolumns(self, select, **kw):
        # Do not call super().get_select_precolumns because
        # it will warn/raise when distinct on is present
        if select._distinct or select._distinct_on:
            if select._distinct_on:
                return (
                    "DISTINCT ON ("
                    + ", ".join(
                        [
                            self.process(col, **kw)
                            for col in select._distinct_on
                        ]
                    )
                    + ") "
                )
            else:
                return "DISTINCT "
        else:
            return "" 
Example #2
Source File: base.py    From jbox with MIT License 5 votes vote down vote up
def get_select_precolumns(self, select, **kw):
        if select._distinct is not False:
            if select._distinct is True:
                return "DISTINCT "
            elif isinstance(select._distinct, (list, tuple)):
                return "DISTINCT ON (" + ', '.join(
                    [self.process(col) for col in select._distinct]
                ) + ") "
            else:
                return "DISTINCT ON (" + \
                    self.process(select._distinct, **kw) + ") "
        else:
            return "" 
Example #3
Source File: base.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def get_select_precolumns(self, select, **kw):
        if select._distinct is not False:
            if select._distinct is True:
                return "DISTINCT "
            elif isinstance(select._distinct, (list, tuple)):
                return "DISTINCT ON (" + ', '.join(
                    [self.process(col) for col in select._distinct]
                ) + ") "
            else:
                return "DISTINCT ON (" + \
                    self.process(select._distinct, **kw) + ") "
        else:
            return "" 
Example #4
Source File: base.py    From planespotter with MIT License 5 votes vote down vote up
def get_select_precolumns(self, select, **kw):
        if select._distinct is not False:
            if select._distinct is True:
                return "DISTINCT "
            elif isinstance(select._distinct, (list, tuple)):
                return "DISTINCT ON (" + ', '.join(
                    [self.process(col) for col in select._distinct]
                ) + ") "
            else:
                return "DISTINCT ON (" + \
                    self.process(select._distinct, **kw) + ") "
        else:
            return "" 
Example #5
Source File: base.py    From pyRevit with GNU General Public License v3.0 5 votes vote down vote up
def get_select_precolumns(self, select, **kw):
        if select._distinct is not False:
            if select._distinct is True:
                return "DISTINCT "
            elif isinstance(select._distinct, (list, tuple)):
                return "DISTINCT ON (" + ', '.join(
                    [self.process(col) for col in select._distinct]
                ) + ") "
            else:
                return "DISTINCT ON (" + \
                    self.process(select._distinct, **kw) + ") "
        else:
            return "" 
Example #6
Source File: base.py    From stdm with GNU General Public License v2.0 5 votes vote down vote up
def get_select_precolumns(self, select):
        if select._distinct is not False:
            if select._distinct is True:
                return "DISTINCT "
            elif isinstance(select._distinct, (list, tuple)):
                return "DISTINCT ON (" + ', '.join(
                    [self.process(col) for col in select._distinct]
                ) + ") "
            else:
                return "DISTINCT ON (" + self.process(select._distinct) + ") "
        else:
            return "" 
Example #7
Source File: base.py    From jarvis with GNU General Public License v2.0 5 votes vote down vote up
def get_select_precolumns(self, select, **kw):
        if select._distinct is not False:
            if select._distinct is True:
                return "DISTINCT "
            elif isinstance(select._distinct, (list, tuple)):
                return "DISTINCT ON (" + ', '.join(
                    [self.process(col) for col in select._distinct]
                ) + ") "
            else:
                return "DISTINCT ON (" + \
                    self.process(select._distinct, **kw) + ") "
        else:
            return "" 
Example #8
Source File: base.py    From moviegrabber with GNU General Public License v3.0 5 votes vote down vote up
def get_select_precolumns(self, select):
        if select._distinct is not False:
            if select._distinct is True:
                return "DISTINCT "
            elif isinstance(select._distinct, (list, tuple)):
                return "DISTINCT ON (" + ', '.join(
                    [self.process(col) for col in select._distinct]
                ) + ") "
            else:
                return "DISTINCT ON (" + self.process(select._distinct) + ") "
        else:
            return "" 
Example #9
Source File: base.py    From android_universal with MIT License 5 votes vote down vote up
def get_select_precolumns(self, select, **kw):
        if select._distinct is not False:
            if select._distinct is True:
                return "DISTINCT "
            elif isinstance(select._distinct, (list, tuple)):
                return "DISTINCT ON (" + ', '.join(
                    [self.process(col, **kw) for col in select._distinct]
                ) + ") "
            else:
                return "DISTINCT ON (" + \
                    self.process(select._distinct, **kw) + ") "
        else:
            return ""