-
-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy path__init__.py
More file actions
149 lines (135 loc) · 3.15 KB
/
Copy path__init__.py
File metadata and controls
149 lines (135 loc) · 3.15 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
"""
The `ormar` package is an async mini ORM for Python, with support for **Postgres,
MySQL**, and **SQLite**.
The main benefit of using `ormar` are:
* getting an **async ORM that can be used with async frameworks**
(fastapi, starlette etc.)
* getting just **one model to maintain** - you don't have to maintain pydantic
and other orm model (sqlalchemy, peewee, gino etc.)
The goal was to create a simple ORM that can be **used directly
(as request and response models)
with `fastapi`** that bases it's data validation on pydantic.
Ormar - apart form obvious ORM in name - get it's name from ormar in swedish which means
snakes, and ormar(e) in italian which means cabinet.
And what's a better name for python ORM than snakes cabinet :)
"""
from ormar.protocols import QuerySetProtocol, RelationProtocol # noqa: I001
from importlib.metadata import version
from ormar.decorators import ( # noqa: I100
post_bulk_update,
post_delete,
post_relation_add,
post_relation_remove,
post_save,
post_update,
pre_delete,
pre_relation_add,
pre_relation_remove,
pre_save,
pre_update,
)
from ormar.exceptions import ( # noqa: I100
ModelDefinitionError,
MultipleMatches,
NoMatch,
)
from ormar.fields import (
DECODERS_MAP,
ENCODERS_MAP,
JSON,
SQL_ENCODERS_MAP,
UUID,
BaseField,
BigInteger,
Boolean,
CheckColumns,
Date,
DateTime,
Decimal,
EncryptBackends,
Enum,
Float,
ForeignKey,
ForeignKeyField,
IndexColumns,
Integer,
LargeBinary,
ManyToMany,
ManyToManyField,
ReferentialAction,
SmallInteger,
String,
Text,
Time,
UniqueColumns,
)
# noqa: I100
from ormar.databases.connection import DatabaseConnection
from ormar.models import ExcludableItems, Extra, Model, OrmarConfig
from ormar.queryset import NullsOrdering, OrderAction, QuerySet, and_, or_
from ormar.relations import RelationType
from ormar.signals import Signal
class UndefinedType: # pragma no cover
def __repr__(self) -> str:
return "OrmarUndefined"
Undefined = UndefinedType()
__version__ = version("ormar")
__all__ = [
"Integer",
"BigInteger",
"SmallInteger",
"Boolean",
"Time",
"Text",
"String",
"JSON",
"DateTime",
"Date",
"Decimal",
"Enum",
"Float",
"ManyToMany",
"Model",
"ModelDefinitionError",
"MultipleMatches",
"NoMatch",
"ForeignKey",
"QuerySet",
"RelationType",
"Undefined",
"UUID",
"UniqueColumns",
"IndexColumns",
"CheckColumns",
"ReferentialAction",
"QuerySetProtocol",
"RelationProtocol",
"post_bulk_update",
"post_delete",
"post_save",
"post_update",
"post_relation_add",
"post_relation_remove",
"pre_delete",
"pre_save",
"pre_update",
"pre_relation_remove",
"pre_relation_add",
"Signal",
"BaseField",
"ManyToManyField",
"ForeignKeyField",
"OrderAction",
"NullsOrdering",
"ExcludableItems",
"and_",
"or_",
"EncryptBackends",
"ENCODERS_MAP",
"SQL_ENCODERS_MAP",
"DECODERS_MAP",
"LargeBinary",
"Extra",
"OrmarConfig",
"DatabaseConnection",
]