cubes_lite/sql/mapping.py
def parse(cls, obj, default_table=None, default_schema=None):
        """Utility function that will create a `Column` reference object from an
           anonymous tuple, dictionary or a similar object. `obj` can also be a
           string in form ``schema.table.column`` where shcema or both schema
           and
           table can be ommited. `default_table` and `default_schema` are
           used when
           no table or schema is provided in `obj`.
           """

        if obj is None:
            raise ArgumentError('Mapping object can not be None')

        if isinstance(obj, compat.string_type):
            obj = obj.split('.')

        schema = None
        table = None
        column = None
        extract = None
        function = None

        if isinstance(obj, (tuple, list)):
            if len(obj) == 1:
                column = obj[0]
                table = None
                schema = None
            elif len(obj) == 2:
                table, column = obj
                schema = None
            elif len(obj) == 3:
                schema, table, column = obj
            else:
                raise ArgumentError(
                    'Join key can have 1 to 3 items (has "{}"): "{}"'
                        .format(len(obj), obj)
                )

        if hasattr(obj, 'get'):
            schema = obj.get('schema')
            table = obj.get('table')
            column = obj.get('column')
            extract = obj.get('extract')
            function = obj.get('function')

        if column is None:
            schema = obj.schema
            table = obj.table
            column = obj.column
            extract = obj.extract
            function = obj.function

        table = table or default_table
        schema = schema or default_schema

        if column is None:
            raise ArgumentError(
                'Cannot parse column representation: "{}"'
                .format(obj)
            )

        return cls(
            schema=schema, table=table, column=column,
            extract=extract, function=function,
        )
Utility function that will create a `Column` reference object from an
           anonymous tuple, dictionary or a similar object. `obj` can also be a
           string in form ``schema.table.column`` where shcema or both schema
           and
           table can be ommited. `default_table` and `default_schema` are
           used when
           no table or schema is provided in `obj`.
           
Utility function that will create a `Column` reference object from an
anonymous tuple, dictionary or a similar object.
Utility function that will create a ` Column ` reference object from an anonymous tuple dictionary or a similar object .
def parse(cls, obj, default_table=None, default_schema=None):
        if obj is None:
            raise ArgumentError('Mapping object can not be None')
        if isinstance(obj, compat.string_type):
            obj = obj.split('.')
        schema = None
        table = None
        column = None
        extract = None
        function = None
        if isinstance(obj, (tuple, list)):
            if len(obj) == 1:
                column = obj[0]
                table = None
                schema = None
            elif len(obj) == 2:
                table, column = obj
                schema = None
            elif len(obj) == 3:
                schema, table, column = obj
            else:
                raise ArgumentError(
                    'Join key can have 1 to 3 items (has "{}"): "{}"'
                        .format(len(obj), obj)
                )
        if hasattr(obj, 'get'):
            schema = obj.get('schema')
            table = obj.get('table')
            column = obj.get('column')
            extract = obj.get('extract')
            function = obj.get('function')
        if column is None:
            schema = obj.schema
            table = obj.table
            column = obj.column
            extract = obj.extract
            function = obj.function
        table = table or default_table
        schema = schema or default_schema
        if column is None:
            raise ArgumentError(
                'Cannot parse column representation: "{}"'
                .format(obj)
            )
        return cls(
            schema=schema, table=table, column=column,
            extract=extract, function=function,
        )
def parse ( cls , obj , default_table = None , default_schema = None ) : if obj is None : raise ArgumentError ( 'Mapping object can not be None' ) if isinstance ( obj , compat . string_type ) : obj = obj . split ( '.' ) schema = None table = None column = None extract = None function = None if isinstance ( obj , ( tuple , list ) ) : if len ( obj ) == 1 : column = obj [ 0 ] table = None schema = None elif len ( obj ) == 2 : table , column = obj schema = None elif len ( obj ) == 3 : schema , table , column = obj else : raise ArgumentError ( 'Join key can have 1 to 3 items (has "{}"): "{}"' . format ( len ( obj ) , obj ) ) if hasattr ( obj , 'get' ) : schema = obj . get ( 'schema' ) table = obj . get ( 'table' ) column = obj . get ( 'column' ) extract = obj . get ( 'extract' ) function = obj . get ( 'function' ) if column is None : schema = obj . schema table = obj . table column = obj . column extract = obj . extract function = obj . function table = table or default_table schema = schema or default_schema if column is None : raise ArgumentError ( 'Cannot parse column representation: "{}"' . format ( obj ) ) return cls ( schema = schema , table = table , column = column , extract = extract , function = function , )
Utility function that will create a `Column` reference object from an
anonymous tuple, dictionary or a similar object.
Utility function that will create a ` Column ` reference object from an anonymous tuple dictionary or a similar object .
"""Utility function that will create a `Column` reference object from an
           anonymous tuple, dictionary or a similar object. `obj` can also be a
           string in form ``schema.table.column`` where shcema or both schema
           and
           table can be ommited. `default_table` and `default_schema` are
           used when
           no table or schema is provided in `obj`.
           """
cls
obj
default_table
default_schema