Ejemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        """ Responsible for:
        * Filter out type-specific kwargs and init Type using these.
        * Filter out `_schema_class` kwargs and init `_schema_class`.
        * Filter out column-slecific kwargs and init column using them.
        * If `args` are provided, that means column proxy is being created.
          In this case Type does not need to be created.
        """
        if not hasattr(self, '_kwargs_backup'):
            self._kwargs_backup = kwargs.copy()

        type_args, type_kw, cleaned_kw = self.process_type_args(kwargs)
        if not args:
            schema_item, cleaned_kw = self._generate_schema_item(cleaned_kw)
        column_kw = self.process_column_args(cleaned_kw)
        # Column proxy is created by declarative extension
        if args:
            column_kw['name'], column_kw['type_'], schema_item = args
        # Column init when defining a schema
        else:
            column_kw['type_'] = self._sqla_type_cls(*type_args, **type_kw)
            if 'type_' not in kwargs:
                self._init_kwargs = self._kwargs_backup.copy()
        column_args = (schema_item, )
        self.es_index = kwargs.get('es_index', True)
        Column.__init__(self, *column_args, **column_kw)
Ejemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        """ Responsible for:
        * Filter out type-specific kwargs and init Type using these.
        * Filter out `_schema_class` kwargs and init `_schema_class`.
        * Filter out column-slecific kwargs and init column using them.
        * If `args` are provided, that means column proxy is being created.
          In this case Type does not need to be created.
        """
        if not hasattr(self, '_kwargs_backup'):
            self._kwargs_backup = kwargs.copy()

        type_args, type_kw, cleaned_kw = self.process_type_args(kwargs)
        if not args:
            schema_item, cleaned_kw = self._generate_schema_item(cleaned_kw)
        column_kw = self.process_column_args(cleaned_kw)
        # Column proxy is created by declarative extension
        if args:
            column_kw['name'], column_kw['type_'], schema_item = args
        # Column init when defining a schema
        else:
            column_kw['type_'] = self._sqla_type_cls(*type_args, **type_kw)
            if 'type_' not in kwargs:
                self._init_kwargs = self._kwargs_backup.copy()
        column_args = (schema_item,)
        return Column.__init__(self, *column_args, **column_kw)
Ejemplo n.º 3
0
 def __init__(self, *args, **kwargs):
     """ Responsible for:
     * Filter out type-specific kwargs and init Type using these.
     * Filter out `_schema_class` kwargs and init `_schema_class`.
     * Filter out column-slecific kwargs and init column using them.
     * If `args` are provided, that means column proxy is being created.
       In this case Type does not need to be created.
     """
     type_args, type_kw, cleaned_kw = self.process_type_args(kwargs)
     if not args:
         schema_item, cleaned_kw = self._generate_schema_item(cleaned_kw)
     column_kw = self.process_column_args(cleaned_kw)
     # Column proxy is created by declarative extension
     if args:
         column_kw['name'], column_kw['type_'], schema_item = args
     # Column init when defining a schema
     else:
         column_kw['type_'] = self._sqla_generic_type(*type_args, **type_kw)
     column_args = (schema_item,)
     return Column.__init__(self, *column_args, **column_kw)
Ejemplo n.º 4
0
 def __init__(self):
     Column.__init__(self, 'foo', Integer)
Ejemplo n.º 5
0
 def __init__(self):
     Column.__init__(self, 'foo', Integer)