Example #1
0
class Rent(SQLObject):
    # Total cost
    totalRent = FloatCol(default=None)
    # Surface in square meters
    livingSpace = FloatCol(default=None)
    # Currency, 3 letter code
    currency = StringCol(length=3, default='EUR')
    # Date of arrival
    moveIn = DateCol(default=None)
    # IP of the user hashed
    ipHash = StringCol(length=512, default=None)
    # Date of creating
    createdAt = DateTimeCol(default=DateTimeCol.now)
Example #2
0
class system_orders(SQLObject):
    forecastType = IntCol()  # Short, Medium, Long

    entryQuote = FloatCol()
    exitQuote = FloatCol()

    entryDate = TimestampCol()
    exitDate = TimestampCol()

    amount = FloatCol()

    firm = ForeignKey('system_firms')

    src_advices = MultipleJoin('system_advices')
Example #3
0
class PersonLocation(SQLBase):
    """A person's location."""

    _defaultOrder = ['id']

    date_created = UtcDateTimeCol(notNull=True, default=UTC_NOW)
    person = ForeignKey(
        dbName='person', foreignKey='Person',
        storm_validator=validate_public_person, notNull=True, unique=True)
    latitude = FloatCol(notNull=False)
    longitude = FloatCol(notNull=False)
    time_zone = StringCol(notNull=True)
    last_modified_by = ForeignKey(
        dbName='last_modified_by', foreignKey='Person',
        storm_validator=validate_public_person, notNull=True)
    date_last_modified = UtcDateTimeCol(notNull=True, default=UTC_NOW)
    visible = BoolCol(notNull=True, default=True)
Example #4
0
class SOValidation(SQLObject):

    name = StringCol(validator=validators.PlainText(),
                     default='x', dbName='name_col')
    name2 = StringCol(validator2=validators.ConfirmType(type=str), default='y')
    name3 = IntCol(validator=validators.Wrapper(fromPython=int), default=100)
    name4 = FloatCol(default=2.718)
    name5 = PickleCol(default=None)
    name6 = BoolCol(default=None)
    name7 = UnicodeCol(default=None)
    name8 = IntCol(default=None)
    name9 = IntCol(validator=validator1, validator2=validator2, default=0)
Example #5
0
    class Journal(SQLObject):
        timestamp = DateTimeCol(default=datetime.now, notNone=True)
        level = IntCol(notNone=True)
        level_index = DatabaseIndex("level")
        text = UnicodeCol(length=255, notNone=True)
        text_index = DatabaseIndex("text")

        col_float1 = FloatCol(default=2.2, notNone=True)
        col_smallint1 = IntCol(default=2, notNone=True)
        col_int1 = IntCol(default=2000000, notNone=True)
        col_bigint1 = IntCol(default=99999999, notNone=True)
        col_char1 = UnicodeCol(length=255, default="value1", notNone=True)
        col_text1 = UnicodeCol(
            default="Moo,Foo,Baa,Waa,Moo,Foo,Baa,Waa,Moo,Foo,Baa,Waa",
            notNone=True)
        col_decimal1 = DecimalCol(size=12,
                                  precision=8,
                                  default=Decimal("2.2"),
                                  notNone=True)
        col_json1 = JSONCol(default={
            "a": 1,
            "b": "b",
            "c": [2],
            "d": {
                "e": 3
            },
            "f": True
        },
                            notNone=True)

        col_float2 = FloatCol(default=None)
        col_smallint2 = IntCol(default=None)
        col_int2 = IntCol(default=None)
        col_bigint2 = IntCol(default=None)
        col_char2 = UnicodeCol(length=255, default=None)
        col_text2 = UnicodeCol(default=None)
        col_decimal2 = DecimalCol(size=12, precision=8, default=None)
        col_json2 = JSONCol(default=None)
Example #6
0
    class Journal(SQLObject):
        timestamp = DateTimeCol(default=datetime.now, notNone=True)
        level = IntCol(notNone=True)
        level_index = DatabaseIndex('level')
        text = UnicodeCol(length=255, notNone=True)
        text_index = DatabaseIndex('text')

        col_float1 = FloatCol(default=2.2, notNone=True)
        col_smallint1 = IntCol(default=2, notNone=True)
        col_int1 = IntCol(default=2000000, notNone=True)
        col_bigint1 = IntCol(default=99999999, notNone=True)
        col_char1 = UnicodeCol(length=255, default='value1', notNone=True)
        col_text1 = UnicodeCol(
            default='Moo,Foo,Baa,Waa,Moo,Foo,Baa,Waa,Moo,Foo,Baa,Waa',
            notNone=True)
        col_decimal1 = DecimalCol(size=12,
                                  precision=8,
                                  default=Decimal('2.2'),
                                  notNone=True)
        col_json1 = JSONCol(default={
            'a': 1,
            'b': 'b',
            'c': [2],
            'd': {
                'e': 3
            },
            'f': True
        },
                            notNone=True)

        col_float2 = FloatCol(default=None)
        col_smallint2 = IntCol(default=None)
        col_int2 = IntCol(default=None)
        col_bigint2 = IntCol(default=None)
        col_char2 = UnicodeCol(length=255, default=None)
        col_text2 = UnicodeCol(default=None)
        col_decimal2 = DecimalCol(size=12, precision=8, default=None)
        col_json2 = JSONCol(default=None)
Example #7
0
class system_modules(SQLObject):
    name = StringCol(alternateID=True, unique=True)
    type = StringCol(
    )  # It's the old block column: Gatherer, MathsAnalysis ...

    version = FloatCol()

    active = BoolCol()

    advices = MultipleJoin('system_advices')
    marks = MultipleJoin('system_modules_marks')

    def _get_rates(self):
        actions = system_modules_marks.select(
            AND(
                system_modules_marks.q.moduleID == self.q.id,
                system_modules_marks.q.date >
                datetime.datetime.now() - datetime.timedelta(3600 * 24)))

        rates = {'rateshort': 0.00, 'ratemedium': 0.00, 'ratelong': 0.00}
        actions = list(actions)
        for action in actions:
            rates['rateshort'] += action.actionS
            rates['ratemedium'] += action.actionM
            rates['ratelong'] += action.actionL

        if rates['rateshort'] <= 0:
            rates['rateshort'] = 0
        if rates['ratemedium'] <= 0:
            rates['ratemedium'] = 0
        if rates['ratelong'] <= 0:
            rates['ratelong'] = 0

        rates['rateshort'] = rates['rateshort'] / len(actions)
        rates['ratemedium'] = rates['ratemedium'] / len(actions)
        rates['ratelong'] = rates['ratelong'] / len(actions)

        return rates

    def _get_rateshort(self):
        rates = self._get_rates()
        return rates['rateshort']

    def _get_ratemedium(self):
        rates = self._get_rates()
        return rates['ratemedium']

    def _get_ratelong(self):
        rates = self._get_rates()
        return rates['ratelong']
Example #8
0
class FloatAccumulator(SQLObject):
    so_value = FloatCol()
Example #9
0
class Ad(SQLObject):
    # "listed" if needs more scraping, "scraped" if it's done
    status = StringCol(length=10, default=None)
    # Name of the website
    site = StringCol(length=30, notNull=True)
    # Date the ad was first scraped
    createdAt = DateTimeCol(default=DateTimeCol.now)
    # The unique ID from the site where it's scrapped from
    siteId = StringCol(length=100, notNull=True)
    # Extra costs (heating mostly)
    serviceCharge = FloatCol(default=None)
    serviceChargeOriginalCurrency = FloatCol(default=None)
    # Base costs (without heating)
    baseRent = FloatCol(default=None)
    baseRentOriginalCurrency = FloatCol(default=None)
    # Total cost
    totalRent = FloatCol(default=None)
    totalRentOriginalCurrency = FloatCol(default=None)
    # Country, 2 letter code
    country = StringCol(length=2, notNull=True)
    # Currency, 3 letter code
    currency = StringCol(length=3, default='EUR')
    # Surface in square meters
    livingSpace = FloatCol(default=None)
    # Price per square meter
    pricePerSqm = FloatCol(default=None)
    # True if the flat or house is furnished
    furnished = BoolCol(default=None)
    # y if realtor, n if rented by a physical person
    realtor = BoolCol(default=None)
    # The name of the realtor or person offering the flat
    realtorName = UnicodeCol(length=300, dbEncoding='utf8', default=None)
    # Latitude
    latitude = FloatCol(default=None)
    # Longitude
    longitude = FloatCol(default=None)
    # "y" if there is a balcony/terrasse
    balcony = BoolCol(default=None)
    # The year the building was built
    yearConstructed = StringCol(length=100, dbEncoding='utf8', default=None)
    # "y" if the flat comes with a cellar
    cellar = BoolCol(default=None)
    # "y" if the flat comes with a parking or a garage
    parking = BoolCol(default=None)
    # House Number in the street
    houseNumber = StringCol(length=100, dbEncoding='utf8', default=None)
    # Street name (incl. "street")
    street = StringCol(length=1000, dbEncoding='utf8', default=None)
    # zip code
    zipCode = StringCol(length=100, default=None)
    # City
    city = UnicodeCol(length=100, dbEncoding='utf8', default=None)
    # y if a lift is present
    lift = BoolCol(default=None)
    # Type of flat (no typology)
    typeOfFlat = StringCol(length=100, default=None)
    # Number of rooms
    noRooms = StringCol(length=10, default=None)
    # Floor the flat is at
    floor = StringCol(length=100, default=None)
    # y if there is a garden
    garden = BoolCol(default=None)
    # y if the flat is wheelchair accessible
    barrierFree = BoolCol(default=None)
    # Country, 2 letter code
    country = StringCol(length=2, default=None)
    # URL of the page
    sourceUrl = StringCol(length=1000, default=None)
    # URL of the page
    description = StringCol(default=None)
    # An ad must be unique on the website
    adIndex = DatabaseIndex('siteId', 'site', unique=True)
Example #10
0
class system_firms_quotations(SQLObject):
    quote = FloatCol()
    date = TimestampCol()

    firm = ForeignKey('system_firms', dbName='system_firms_id')
Example #11
0
class SQLiteTruedivTest(SQLObject):
    value = FloatCol()
Example #12
0
class Scan(SQLObject):
    timestamp = FloatCol(notNone=False)
    device = sqlobject.ForeignKey('Device')
    present = BoolCol(default=False)