Note: we handle connection caching for all of our SDKs.

Client

The Client class is the main entry point for interacting with the Fortress platform. Here is a link to the Github

Initialization

fortress = Fortress(
    org_id: str
    api_key: str
) -> None

type Fortress

The Fortress type is a client to access the Fortress APIs.

Tenant actions

Tenant actions are the main way used to interact with tenant data on the Fortress platform. This is the way to guarantee that data only comes from a specific tenant. Fortress will ensure tenant isolation using this method. Once a tenant is connected, all queries will only return that tenant’s data.

Connect to a tenant

fortress.connect_tenant(tenant_id: str) -> ConnectionInterface

Create a tenant

fortress.create_tenant(tenant_id: str, isolation_level: str, platform: str, alias_name: Optional[str], database_id: Optional[str]) -> None
  • isolation_level: can be either ‘shared’ or ‘dedicated’
  • Important Note: alias_name is an optional name that you can give a specific tenant to make interacting with them easier. If it is not included in this function, the alias_name for a tenant will be just the tenant_id
  • Important Note: database_id is an optional field that takes in a string. If it is included, then the tenant will be added to an existing database. If not, a new database would automatically be created for the tenant.
  • Important Note: platform can be either ‘aws’ or ‘managed’

Delete a tenant

fortress.delete_tenant(tenant_id: str) -> None
  • Important Note: Deleting a tenant using this will just remove the connection to the database but will not delete the data. We are working on this feature soon!

List tenants

fortress.list_tenants() -> list[Tenant]

Database actions

Database actions are used to interact with the entire database on the Fortress platform.

Create a database

fortress.create_database(alias: str, platform: str) -> str
  • platform: can be either ‘aws’ or ‘managed’

Delete a database

fortress.delete_database(database_id: str) -> None
  • Important Note: Deleting a database will delete all the data inside of it, but will not delete the tenant objects that are attached to it.

List databases

fortress.list_databases() -> list[Database]

type Connection

The Connection type is a object that represents a connection to a database.

Commit

conn.commit() -> None

Cursor

conn.cursor() -> CursorInterface

Sync

conn.sync() -> None

Rollback

conn.rollback() -> None

Execute

conn.execute(sql: str, parameters: tuple[Any] = ...) -> Cursor

Execute Many

conn.executemany(sql: str, parameters: list[tuple[Any]] = ...) -> CursorInterface

Execute Script

conn.executescript(script: str) -> None

type Cursor

The Cursor type is a object that represents a cursor to a database. A cursor is used to hold transaction state across executions.

Sync

conn.sync() -> None

Rollback

conn.rollback() -> None

Execute

conn.execute(sql: str, parameters: tuple[Any] = ...) -> Cursor

Execute Many

conn.executemany(sql: str, parameters: list[tuple[Any]] = ...) -> CursorInterface

Execute Script

conn.executescript(script: str) -> None