Skip to content

AmsdalManager

AmsdalManager is the top-level class that manages your AMSDAL application lifecycle: initialization, connections, migrations, fixtures, and teardown.

from amsdal.manager import AmsdalManager

Constructor

AmsdalManager(*, raise_on_new_signup: bool = False)

Parameter Type Default Description
raise_on_new_signup bool False If True, raises AmsdalSignupError on new signup instead of completing the signup process

Initializes all sub-managers and reads the configuration. Sets up the internal data application, class manager, metadata manager, and authentication manager.

Raises: AmsdalRuntimeError if configuration is missing.


Properties

is_setupbool

Returns True if the manager has been set up.

is_authenticatedbool

Returns True if the AMSDAL license authentication process has passed.


Methods

pre_setup() → None

Initializes the models root path and adds it to sys.path. Sets up the class manager's models modules.

setup() → None

Initializes the models root path and establishes connections. Can only be called once.

Raises: AmsdalRuntimeError if the manager is already set up.

post_setup() → None

Registers internal classes and prepares connections (creates internal tables). Decorated with @transaction.

authenticate() → None

Runs the AMSDAL license authentication process.

apply_fixtures() → None

Loads and applies fixtures defined in your application. Decorated with @transaction.

teardown() → None

Cleans up on application exit: disconnects and invalidates connections, clears caches, and resets setup status.

Raises: AmsdalRuntimeError if the manager is not set up.


AsyncAmsdalManager

Async variant with the same interface. Methods setup(), post_setup(), apply_fixtures(), and teardown() are async.

from amsdal.manager import AsyncAmsdalManager

manager = AsyncAmsdalManager()
await manager.setup()
await manager.post_setup()
await manager.apply_fixtures()
# ...
await manager.teardown()