forked from piccolo-orm/piccolo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtables.py
More file actions
56 lines (49 loc) · 1.11 KB
/
tables.py
File metadata and controls
56 lines (49 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""
This is a useful table when we want to test all possible column types.
"""
from piccolo.columns.column_types import (
JSON,
JSONB,
UUID,
BigInt,
Boolean,
Bytea,
Date,
ForeignKey,
Integer,
Interval,
Numeric,
Real,
SmallInt,
Text,
Timestamp,
Timestamptz,
Varchar,
)
from piccolo.table import Table
class SmallTable(Table):
varchar_col = Varchar()
class MegaTable(Table):
"""
A table containing all of the column types, and different column kwargs.
"""
bigint_col = BigInt()
boolean_col = Boolean()
bytea_col = Bytea()
date_col = Date()
foreignkey_col = ForeignKey(SmallTable)
integer_col = Integer()
interval_col = Interval()
json_col = JSON()
jsonb_col = JSONB()
numeric_col = Numeric(digits=(5, 2))
real_col = Real()
smallint_col = SmallInt()
text_col = Text()
timestamp_col = Timestamp()
timestamptz_col = Timestamptz()
uuid_col = UUID()
varchar_col = Varchar()
unique_col = Varchar(unique=True)
null_col = Varchar(null=True)
not_null_col = Varchar(null=False)