Python sqlalchemy.sql.expression._truncated_label() Examples

The following are 11 code examples of sqlalchemy.sql.expression._truncated_label(). 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.sql.expression , or try the search function .
Example #1
Source File: base.py    From jbox with MIT License 6 votes vote down vote up
def visit_alias(self, alias, asfrom=False, **kwargs):
        if self.dialect._version_two:
            return super(FBCompiler, self).\
                visit_alias(alias, asfrom=asfrom, **kwargs)
        else:
            # Override to not use the AS keyword which FB 1.5 does not like
            if asfrom:
                alias_name = isinstance(alias.name,
                                        expression._truncated_label) and \
                    self._truncated_identifier("alias",
                                               alias.name) or alias.name

                return self.process(
                    alias.original, asfrom=asfrom, **kwargs) + \
                    " " + \
                    self.preparer.format_alias(alias, alias_name)
            else:
                return self.process(alias.original, **kwargs) 
Example #2
Source File: base.py    From Fluid-Designer with GNU General Public License v3.0 6 votes vote down vote up
def visit_alias(self, alias, asfrom=False, **kwargs):
        if self.dialect._version_two:
            return super(FBCompiler, self).\
                visit_alias(alias, asfrom=asfrom, **kwargs)
        else:
            # Override to not use the AS keyword which FB 1.5 does not like
            if asfrom:
                alias_name = isinstance(alias.name,
                                        expression._truncated_label) and \
                    self._truncated_identifier("alias",
                                               alias.name) or alias.name

                return self.process(
                    alias.original, asfrom=asfrom, **kwargs) + \
                    " " + \
                    self.preparer.format_alias(alias, alias_name)
            else:
                return self.process(alias.original, **kwargs) 
Example #3
Source File: base.py    From planespotter with MIT License 6 votes vote down vote up
def visit_alias(self, alias, asfrom=False, **kwargs):
        if self.dialect._version_two:
            return super(FBCompiler, self).\
                visit_alias(alias, asfrom=asfrom, **kwargs)
        else:
            # Override to not use the AS keyword which FB 1.5 does not like
            if asfrom:
                alias_name = isinstance(alias.name,
                                        expression._truncated_label) and \
                    self._truncated_identifier("alias",
                                               alias.name) or alias.name

                return self.process(
                    alias.original, asfrom=asfrom, **kwargs) + \
                    " " + \
                    self.preparer.format_alias(alias, alias_name)
            else:
                return self.process(alias.original, **kwargs) 
Example #4
Source File: base.py    From pyRevit with GNU General Public License v3.0 6 votes vote down vote up
def visit_alias(self, alias, asfrom=False, **kwargs):
        if self.dialect._version_two:
            return super(FBCompiler, self).\
                visit_alias(alias, asfrom=asfrom, **kwargs)
        else:
            # Override to not use the AS keyword which FB 1.5 does not like
            if asfrom:
                alias_name = isinstance(alias.name,
                                        expression._truncated_label) and \
                    self._truncated_identifier("alias",
                                               alias.name) or alias.name

                return self.process(
                    alias.original, asfrom=asfrom, **kwargs) + \
                    " " + \
                    self.preparer.format_alias(alias, alias_name)
            else:
                return self.process(alias.original, **kwargs) 
Example #5
Source File: base.py    From stdm with GNU General Public License v2.0 6 votes vote down vote up
def visit_alias(self, alias, asfrom=False, **kwargs):
        if self.dialect._version_two:
            return super(FBCompiler, self).\
                visit_alias(alias, asfrom=asfrom, **kwargs)
        else:
            # Override to not use the AS keyword which FB 1.5 does not like
            if asfrom:
                alias_name = isinstance(alias.name,
                                        expression._truncated_label) and \
                    self._truncated_identifier("alias",
                                               alias.name) or alias.name

                return self.process(
                    alias.original, asfrom=asfrom, **kwargs) + \
                    " " + \
                    self.preparer.format_alias(alias, alias_name)
            else:
                return self.process(alias.original, **kwargs) 
Example #6
Source File: base.py    From stdm with GNU General Public License v2.0 6 votes vote down vote up
def visit_alias(self, alias, asfrom=False, ashint=False, **kwargs):
        """Oracle doesn't like ``FROM table AS alias``.  Is the AS standard
        SQL??
        """

        if asfrom or ashint:
            alias_name = isinstance(alias.name, expression._truncated_label) and \
                self._truncated_identifier("alias", alias.name) or alias.name

        if ashint:
            return alias_name
        elif asfrom:
            return self.process(alias.original, asfrom=asfrom, **kwargs) + \
                " " + self.preparer.format_alias(alias, alias_name)
        else:
            return self.process(alias.original, **kwargs) 
Example #7
Source File: base.py    From sqlalchemy with MIT License 6 votes vote down vote up
def visit_alias(self, alias, asfrom=False, **kwargs):
        if self.dialect._version_two:
            return super(FBCompiler, self).visit_alias(
                alias, asfrom=asfrom, **kwargs
            )
        else:
            # Override to not use the AS keyword which FB 1.5 does not like
            if asfrom:
                alias_name = (
                    isinstance(alias.name, expression._truncated_label)
                    and self._truncated_identifier("alias", alias.name)
                    or alias.name
                )

                return (
                    self.process(alias.element, asfrom=asfrom, **kwargs)
                    + " "
                    + self.preparer.format_alias(alias, alias_name)
                )
            else:
                return self.process(alias.element, **kwargs) 
Example #8
Source File: base.py    From jarvis with GNU General Public License v2.0 6 votes vote down vote up
def visit_alias(self, alias, asfrom=False, **kwargs):
        if self.dialect._version_two:
            return super(FBCompiler, self).\
                visit_alias(alias, asfrom=asfrom, **kwargs)
        else:
            # Override to not use the AS keyword which FB 1.5 does not like
            if asfrom:
                alias_name = isinstance(alias.name,
                                        expression._truncated_label) and \
                    self._truncated_identifier("alias",
                                               alias.name) or alias.name

                return self.process(
                    alias.original, asfrom=asfrom, **kwargs) + \
                    " " + \
                    self.preparer.format_alias(alias, alias_name)
            else:
                return self.process(alias.original, **kwargs) 
Example #9
Source File: base.py    From moviegrabber with GNU General Public License v3.0 6 votes vote down vote up
def visit_alias(self, alias, asfrom=False, **kwargs):
        if self.dialect._version_two:
            return super(FBCompiler, self).\
                        visit_alias(alias, asfrom=asfrom, **kwargs)
        else:
            # Override to not use the AS keyword which FB 1.5 does not like
            if asfrom:
                alias_name = isinstance(alias.name,
                                expression._truncated_label) and \
                                self._truncated_identifier("alias",
                                alias.name) or alias.name

                return self.process(
                            alias.original, asfrom=asfrom, **kwargs) + \
                            " " + \
                            self.preparer.format_alias(alias, alias_name)
            else:
                return self.process(alias.original, **kwargs) 
Example #10
Source File: base.py    From android_universal with MIT License 6 votes vote down vote up
def visit_alias(self, alias, asfrom=False, **kwargs):
        if self.dialect._version_two:
            return super(FBCompiler, self).\
                visit_alias(alias, asfrom=asfrom, **kwargs)
        else:
            # Override to not use the AS keyword which FB 1.5 does not like
            if asfrom:
                alias_name = isinstance(alias.name,
                                        expression._truncated_label) and \
                    self._truncated_identifier("alias",
                                               alias.name) or alias.name

                return self.process(
                    alias.original, asfrom=asfrom, **kwargs) + \
                    " " + \
                    self.preparer.format_alias(alias, alias_name)
            else:
                return self.process(alias.original, **kwargs) 
Example #11
Source File: base.py    From moviegrabber with GNU General Public License v3.0 5 votes vote down vote up
def visit_alias(self, alias, asfrom=False, ashint=False, **kwargs):
        """Oracle doesn't like ``FROM table AS alias``.  Is the AS standard SQL??"""

        if asfrom or ashint:
            alias_name = isinstance(alias.name, expression._truncated_label) and \
                            self._truncated_identifier("alias", alias.name) or alias.name

        if ashint:
            return alias_name
        elif asfrom:
            return self.process(alias.original, asfrom=asfrom, **kwargs) + \
                            " " + self.preparer.format_alias(alias, alias_name)
        else:
            return self.process(alias.original, **kwargs)