示例#1
0
 def test_column(self):
     col = Column('b')
     self._assert_equal_filter(col > 2, Greater('b', 2))
     self._assert_equal_filter(col >= 2, GreaterEqual('b', 2))
     self._assert_equal_filter(col < 2, Less('b', 2))
     self._assert_equal_filter(col <= 2, LessEqual('b', 2))
     self._assert_equal_filter(col == 2, Equal('b', 2))
     self._assert_equal_filter(col != 2, ~Equal('b', 2))
     self._assert_equal_filter(col.isin([1, 2, 3]), IsIn('b', [1, 2, 3]))
示例#2
0
 def __getattr__(self, name):
     """
     Returns a :class:`types.Column <pandasticsearch.types.Column>` object denoted by ``name``.
     """
     if name not in self.columns:
         raise AttributeError(
             "'%s' object has no attribute '%s'" % (self.__class__.__name__, name))
     return Column(name)
示例#3
0
 def __getattr__(self, name):
     """
     Returns the :class:`Column` denoted by ``name``.
     """
     if name not in self.columns:
         raise AttributeError("'%s' object has no attribute '%s'" %
                              (self.__class__.__name__, name))
     return Column(name)
示例#4
0
 def __getitem__(self, item):
     if isinstance(item, six.string_types):
         if item not in self.columns:
             raise TypeError('Column does not exist: [{0}]'.format(item))
         return Column(item)
     elif isinstance(item, BooleanFilter):
         self._filter = item.build()
         return self
     else:
         raise TypeError('Unsupported expr: [{0}]'.format(item))
示例#5
0
 def test_column(self):
     col = Column('b')
     self._assert_equal_filter(col > 2, Greater('b', 2))
     self._assert_equal_filter(col >= 2, GreaterEqual('b', 2))
     self._assert_equal_filter(col < 2, Less('b', 2))
     self._assert_equal_filter(col <= 2, LessEqual('b', 2))
     self._assert_equal_filter(col == 2, Equal('b', 2))
     self._assert_equal_filter(col != 2, ~Equal('b', 2))
     self._assert_equal_filter(col.isin([1, 2, 3]), IsIn('b', [1, 2, 3]))
     self._assert_equal_filter(col.like('a*b'), Like('b', 'a*b'))
     self._assert_equal_filter(col.rlike('a*b'), Rlike('b', 'a*b'))
     self._assert_equal_filter(col.startswith('jj'), Startswith('b', 'jj'))
     self._assert_equal_filter(col.isnull, IsNull('b'))
     self._assert_equal_filter(col.notnull, NotNull('b'))