prefect.server.models.block_types
Functions for interacting with block type ORM objects. Intended for internal use by the Prefect REST API.
create_block_type(db, session, block_type, override=False)
async
Create a new block type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AsyncSession
|
A database session |
required |
block_type
|
Union[BlockType, BlockType]
|
a block type object |
required |
Returns:
Name | Type | Description |
---|---|---|
block_type |
Union[BlockType, None]
|
an ORM block type model |
Source code in src/prefect/server/models/block_types.py
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 |
|
delete_block_type(session, block_type_id)
async
Delete a block type by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AsyncSession
|
A database session |
required |
block_type_id
|
str
|
A block type id |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the block type was updated |
Source code in src/prefect/server/models/block_types.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
|
read_block_type(session, block_type_id)
async
Reads a block type by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AsyncSession
|
A database session |
required |
block_type_id
|
UUID
|
a block_type id |
required |
Returns:
Name | Type | Description |
---|---|---|
BlockType |
Union[BlockType, None]
|
an ORM block type model |
Source code in src/prefect/server/models/block_types.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
read_block_type_by_slug(session, block_type_slug)
async
Reads a block type by slug.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AsyncSession
|
A database session |
required |
block_type_slug
|
str
|
a block type slug |
required |
Returns:
Name | Type | Description |
---|---|---|
BlockType |
Union[BlockType, None]
|
an ORM block type model |
Source code in src/prefect/server/models/block_types.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
read_block_types(session, block_type_filter=None, block_schema_filter=None, limit=None, offset=None)
async
Reads block types with an optional limit and offset
Args:
Returns:
Type | Description |
---|---|
Sequence[BlockType]
|
List[BlockType]: List of |
Source code in src/prefect/server/models/block_types.py
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 150 151 152 |
|
update_block_type(session, block_type_id, block_type)
async
Update a block type by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AsyncSession
|
A database session |
required |
block_type_id
|
Union[str, UUID]
|
Data to update block type with |
required |
block_type
|
Union[BlockTypeUpdate, BlockType, BlockTypeUpdate, BlockType]
|
A block type id |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the block type was updated |
Source code in src/prefect/server/models/block_types.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|