Пример #1
0
class TestObjBase:
    idx: int = doctable.IDCol()
    size: int = 10000000

    def __post_init__(self):
        if self.data is None:
            self.data = [random.randrange(10**12)] * self.size
Пример #2
0
class MyClass:
    name: str = doctable.Col(unique=True)

    # builtin column types
    idx: int = doctable.IDCol()
    updated: datetime.datetime = doctable.UpdatedCol()
    added: datetime.datetime = doctable.AddedCol()

    # custom column types
    lon: float = doctable.Col()
    lat: float = doctable.Col()

    # use Col to use factory to construct emtpy list
    # will be stored as binary/pickle type, since no other available
    elements: Sequence = doctable.Col(list)

    # indices and constraints
    _indices_ = {
        doctable.Index('lonlat_index', 'lon', 'lat', unique=True),
        #'lonlat_index': ('lon', 'lat', {'unique':True}),
        #'name_index': ('name',),
        doctable.Index('name_index', 'name'),
    }
    _constraints_ = (
        doctable.Constraint('check', 'lon > 0', name='check_lon'),
        doctable.Constraint('check', 'lat > 0'),
        #('foreignkey', ('a','b'), ('c','d'))
    )
Пример #3
0
class NoSlots:
    id: int = doctable.IDCol()
    a: int = doctable.Col()
    b: int = doctable.Col(5)
    c: int = doctable.Col(10)
    d: int = doctable.Col(10)
    e: int = doctable.Col(10)
    f: int = doctable.Col(10)
    g: int = doctable.Col(10)
    h: int = doctable.Col(10)
Пример #4
0
class WithSlots:
    __slots__ = []
    id: int = doctable.IDCol()
    a: int = doctable.Col()
    b: int = doctable.Col(5)
    c: int = doctable.Col(10)
    d: int = doctable.Col(10)
    e: int = doctable.Col(10)
    f: int = doctable.Col(10)
    g: int = doctable.Col(10)
    h: int = doctable.Col(10)
Пример #5
0
class TestRow:
    __slots__ = []
    id: int = doctable.IDCol()
    doc: doctable.ParseTreeDoc = doctable.Col(type_kwargs=dict(
        folder='tmp/parsed_trees'))
Пример #6
0
class Child:
    __slots__ = []
    id: int = doctable.IDCol()
    name: str = doctable.Col()
    parent_name: str = doctable.Col()
Пример #7
0
class Parent:
    __slots__ = []
    id: int = doctable.IDCol()
    name: str = doctable.Col()
Пример #8
0
class FileObj:
    id: int = doctable.IDCol()
    data: np.ndarray = doctable.Col(None,
                                    coltype='picklefile',
                                    type_args=dict(folder=folder))
Пример #9
0
class DataObj:
    __slots__ = []
    id: int = doctable.IDCol()
    data: np.ndarray = doctable.Col(None)