class WeblogEntry(Base):

    __tablename__ = "weblog_entries"

    raw_text = Column(types.Nullable(types.String), primary_key=True)
    remote_address = Column(types.String)
    remote_user = Column(types.Nullable(types.String))
    created_on = Column(types.DateTime)
    method = Column(types.String)
    request_uri = Column(types.String)
    http_version = Column(types.Nullable(types.String))
    response_status = Column(types.Nullable(types.Int))
    response_bytes_sent = Column(types.Nullable(types.Int))
    http_referrer = Column(types.Nullable(types.String))
    http_user_agent = Column(types.Nullable(types.String))
    forwarded_for_ips = Column(types.Nullable(types.String))
    hostname = Column(types.Nullable(types.String))
    server_name = Column(types.Nullable(types.String))
    request_time = Column(types.Nullable(types.Decimal(precision=10, scale=4)))
    upstream_status = Column(types.Nullable(types.Int))
    upstream_response_time = Column(
        types.Nullable(types.Decimal(precision=10, scale=4)))
    upstream_response_length = Column(types.Nullable(types.Int))
    clientip = Column(types.Nullable(types.String))
    user_id = Column(types.Nullable(types.String))
    session_id = Column(types.Nullable(types.String))

    __table_args__ = (engines.ReplacingMergeTree(
        primary_key=(created_on, remote_address, method, request_uri),
        order_by=(created_on, remote_address, method, request_uri)), )
Example #2
0
    def test_create_table_decimal_symlink(self):
        table = Table('test', TypesTestCase.metadata(),
                      Column('x', types.Decimal(10, 2)), engines.Memory())

        self.assertEqual(
            self.compile(CreateTable(table)),
            'CREATE TABLE test (x Decimal(10, 2)) ENGINE = Memory')
    def test_decimal(self):
        coltype = self._type_round_trip(types.Decimal(38, 38))[0]

        self.assertIsInstance(coltype, types.Decimal)
        self.assertEqual(coltype.precision, 38)
        self.assertEqual(coltype.scale, 38)