AMSDAL Integrations¶
The amsdal_integrations package allows you to build integrations with any third-party Python application, to collect and push data to AMSDAL.
There are two implemented clients:
- Direct client (AmsdalClient or AsyncAmsdalClient) is the best choice for simple integrations or testing but can affect the performance of the integrated application
- Agent client (AgentClient or AsyncAgentClient) limits performance affect but requires running the amsdal_agent separately
You can find the the repository on Github here: amsdal_integrations. The tools
directory contains prebuilt integrations for:
- SQLAlchemy (Coming soon!)
- Django ORM (Coming soon!)
AMSDAL SDK¶
amsdal_integrations.core.AmsdalIntegration ¶
Source code in amsdal_integrations/core.py
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 |
|
register_schema ¶
register_schema(
schema, operation_id=None, *, skip_data_migrations=False
)
Register a new schema/model version in AMSDAL application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schema
|
Schema
|
The schema/model to register. |
required |
operation_id
|
str | None
|
The operation id to use for this request. This is useful to prevent duplicated requests. Defaults to None. |
None
|
skip_data_migrations
|
bool
|
Whether to skip data migrations if a new version of schema is registering. Defaults to False. |
False
|
Source code in amsdal_integrations/core.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
unregister_schema ¶
unregister_schema(class_name, operation_id=None)
Unregister a schema/model from AMSDAL application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
The name of the schema/model to unregister. |
required |
operation_id
|
str | None
|
The operation id to use for this request. This is useful to prevent duplicated requests. Defaults to None. |
None
|
Source code in amsdal_integrations/core.py
53 54 55 56 57 58 59 60 61 62 63 |
|
create ¶
create(class_name, data, operation_id=None)
Create a new object/data in AMSDAL application by specific class name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
The name of the schema/model to create. |
required |
data
|
dict[str, Any]
|
The data to create. |
required |
operation_id
|
str | None
|
The operation id to use for this request. This is useful to prevent duplicated requests. Defaults to None. |
None
|
Source code in amsdal_integrations/core.py
65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
update ¶
update(class_name, object_id, data, operation_id=None)
Update an existing object/data in AMSDAL application by specific class name and object id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
The name of the schema/model to update. |
required |
object_id
|
str
|
The id of the object to update. |
required |
data
|
dict[str, Any]
|
The data to update. |
required |
operation_id
|
str | None
|
The operation id to use for this request. This is useful to prevent duplicated requests. Defaults to None. |
None
|
Source code in amsdal_integrations/core.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
delete ¶
delete(class_name, object_id, operation_id=None)
Delete an existing object/data in AMSDAL application by specific class name and object id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
The name of the schema/model to delete. |
required |
object_id
|
str
|
The id of the object to delete. |
required |
operation_id
|
str | None
|
The operation id to use for this request. This is useful to prevent duplicated requests. Defaults to None. |
None
|
Source code in amsdal_integrations/core.py
95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
SDK Config¶
amsdal_integrations.data_classes.IntegrationConfig
dataclass
¶
Source code in amsdal_integrations/data_classes.py
8 9 10 11 12 13 14 15 |
|
amsdal_host
instance-attribute
¶
amsdal_host
The host of the destination AMSDAL application or of the running AMSDAL Agent. Example: http://localhost:8054
amsdal_auth
instance-attribute
¶
amsdal_auth
The auth mechanism that will be used to communicate with amsdal_host
. Can be any httpx.Auth instance.
client_extra
class-attribute
instance-attribute
¶
client_extra = field(default_factory=dict)
Extra parameters that will be passed to the httpx.Client constructor. Example: {'timeout': 10}
Clients¶
amsdal_integrations.clients.amsdal_client.AmsdalClient ¶
Bases: BaseClient
Source code in amsdal_integrations/clients/amsdal_client.py
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 150 151 152 153 154 155 156 157 158 |
|
register_schema ¶
register_schema(
schema, operation_id=None, *, skip_data_migrations=False
)
Sends a new schema of your model version directly to the AMSDAL Application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schema
|
Schema
|
Schema of your model version. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
skip_data_migrations
|
bool
|
Skip data migrations. |
False
|
Source code in amsdal_integrations/clients/amsdal_client.py
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 |
|
unregister_schema ¶
unregister_schema(class_name, operation_id=None)
Send a request to unregister a schema of your model version directly from AMSDAL Application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/amsdal_client.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
create ¶
create(class_name, data, operation_id=None)
Send a request to create an object of your model directly to AMSDAL Application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
data
|
dict[str, Any]
|
Data of the object. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/amsdal_client.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
update ¶
update(class_name, object_id, data, operation_id=None)
Send a request to update an object of your model directly to AMSDAL Application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
object_id
|
str
|
ID of the object. |
required |
data
|
dict[str, Any]
|
Data of the object. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/amsdal_client.py
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 |
|
delete ¶
delete(class_name, object_id, operation_id=None)
Send a request to delete an object of your model directly to AMSDAL Application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
object_id
|
str
|
ID of the object. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/amsdal_client.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
amsdal_integrations.clients.amsdal_client.AsyncAmsdalClient ¶
Bases: AsyncBaseClient
Async version of the AMSDAL Client.
Source code in amsdal_integrations/clients/amsdal_client.py
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 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
register_schema
async
¶
register_schema(
schema, operation_id=None, *, skip_data_migrations=False
)
Sends a new schema of your model version directly to the AMSDAL Application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schema
|
Schema
|
Schema of your model version. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
skip_data_migrations
|
bool
|
Skip data migrations. |
False
|
Source code in amsdal_integrations/clients/amsdal_client.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
|
unregister_schema
async
¶
unregister_schema(class_name, operation_id=None)
Send a request to unregister a schema of your model version directly from AMSDAL Application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/amsdal_client.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
create
async
¶
create(class_name, data, operation_id=None)
Send a request to create an object of your model directly to AMSDAL Application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
data
|
dict[str, Any]
|
Data of the object. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/amsdal_client.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
|
update
async
¶
update(class_name, object_id, data, operation_id=None)
Send a request to update an object of your model directly to AMSDAL Application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
object_id
|
str
|
ID of the object. |
required |
data
|
dict[str, Any]
|
Data of the object. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/amsdal_client.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
delete
async
¶
delete(class_name, object_id, operation_id=None)
Send a request to delete an object of your model directly to AMSDAL Application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
object_id
|
str
|
ID of the object. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/amsdal_client.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
amsdal_integrations.clients.agent_client.AgentClient ¶
Bases: BaseClient
Agent Client that communicate with the AMSDAL Agent to avoid any performance issues.
Source code in amsdal_integrations/clients/agent_client.py
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 150 151 152 153 154 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 |
|
register_schema ¶
register_schema(
schema, operation_id=None, *, skip_data_migrations=False
)
Sends a new schema of your model version to the AMSDAL Agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schema
|
Schema
|
Schema of your model version. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
skip_data_migrations
|
bool
|
Skip data migrations. |
False
|
Source code in amsdal_integrations/clients/agent_client.py
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 |
|
unregister_schema ¶
unregister_schema(class_name, operation_id=None)
Send a request to unregister a schema of your model version from the AMSDAL Agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/agent_client.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
create ¶
create(class_name, data, operation_id=None)
Send a request to create an object of your model to the AMSDAL Agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
data
|
dict[str, Any]
|
Data of the object. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/agent_client.py
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 |
|
update ¶
update(class_name, object_id, data, operation_id=None)
Send a request to update an object of your model to the AMSDAL Agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
object_id
|
str
|
ID of the object. |
required |
data
|
dict[str, Any]
|
Data of the object. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/agent_client.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
delete ¶
delete(class_name, object_id, operation_id=None)
Send a request to delete an object of your model to the AMSDAL Agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
object_id
|
str
|
ID of the object. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/agent_client.py
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 |
|
amsdal_integrations.clients.agent_client.AsyncAgentClient ¶
Bases: AsyncBaseClient
Async Agent Client that communicate with the AMSDAL Agent to avoid any performance issues.
Source code in amsdal_integrations/clients/agent_client.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
|
register_schema
async
¶
register_schema(
schema, operation_id=None, *, skip_data_migrations=False
)
Sends a new schema of your model version to the AMSDAL Agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schema
|
Schema
|
Schema of your model version. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
skip_data_migrations
|
bool
|
Skip data migrations. |
False
|
Source code in amsdal_integrations/clients/agent_client.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
|
unregister_schema
async
¶
unregister_schema(class_name, operation_id=None)
Send a request to unregister a schema of your model version from the AMSDAL Agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/agent_client.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
|
create
async
¶
create(class_name, data, operation_id=None)
Send a request to create an object of your model to the AMSDAL Agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
data
|
dict[str, Any]
|
Data of the object. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/agent_client.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
|
update
async
¶
update(class_name, object_id, data, operation_id=None)
Send a request to update an object of your model to the AMSDAL Agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
object_id
|
str
|
ID of the object. |
required |
data
|
dict[str, Any]
|
Data of the object. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/agent_client.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
|
delete
async
¶
delete(class_name, object_id, operation_id=None)
Send a request to delete an object of your model to the AMSDAL Agent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
class_name
|
str
|
Name of the class. |
required |
object_id
|
str
|
ID of the object. |
required |
operation_id
|
str | None
|
Operation ID for the request. |
None
|
Source code in amsdal_integrations/clients/agent_client.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
|
Data classes¶
amsdal_integrations.data_classes.Schema
dataclass
¶
Source code in amsdal_integrations/data_classes.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
title
instance-attribute
¶
title
The name of the schema/model/class. Should be valid Python class name. Example: User
type
class-attribute
instance-attribute
¶
type = 'object'
The type of the schema. Should be object
for now.
properties
class-attribute
instance-attribute
¶
properties = field(default_factory=dict)
The properties of the schema. Example: {'name': {'type': 'string', 'default': 'John Doe'}}
required
class-attribute
instance-attribute
¶
required = field(default_factory=list)
The required properties of the schema. Example: ['name']
indexed
class-attribute
instance-attribute
¶
indexed = field(default_factory=list)
The indexed properties of the schema. Example: ['name']
unique
class-attribute
instance-attribute
¶
unique = field(default_factory=list)
The unique properties of the schema. Example: [['name', 'email']]
custom_code
class-attribute
instance-attribute
¶
custom_code = ''
The custom code of the schema. Example: def __str__(self): return self.name
amsdal_integrations.data_classes.PropertySchema
dataclass
¶
Source code in amsdal_integrations/data_classes.py
42 43 44 45 46 47 48 49 50 51 52 53 |
|
type
instance-attribute
¶
type
The type of the property. Should be valid AMSDAL type. Example: string
items
class-attribute
instance-attribute
¶
items = None
The items of the property in case of type is array
or dictionary
. Example: {'type': 'string'}
options
class-attribute
instance-attribute
¶
options = None
The options of available values for this property.
amsdal_integrations.data_classes.OptionSchema
dataclass
¶
Source code in amsdal_integrations/data_classes.py
34 35 36 37 38 39 |
|
amsdal_integrations.data_classes.TypeSchema
dataclass
¶
Source code in amsdal_integrations/data_classes.py
26 27 28 29 30 31 |
|
amsdal_integrations.data_classes.DictItem
dataclass
¶
Source code in amsdal_integrations/data_classes.py
18 19 20 21 22 23 |
|