lamindb.setup¶
Setup & configure LaminDB.
Many functions in this “setup API” have a matching command in the CLI CLI.
Guide: Install & setup.
Basic operations¶
- lamindb.setup.login(user=None, *, api_key=None, **kwargs)¶
Log into LaminHub.
login()prompts for your API key unless you set it via theLAMIN_API_KEYenvironment variable or pass it as an argument.You can create your API key in your account settings on LaminHub (top right corner).
- Parameters:
user (
str|None, default:None) – User handle.api_key (
str|None, default:None) – API key.
- Return type:
See also
Login via the CLI command
lamin login, see here.Examples
Logging in the first time:
import lamindb as ln ln.setup.login() # prompts for API key
After authenticating multiple users, you can switch between user profiles:
ln.setup.login("myhandle") # pass your user handle
- lamindb.setup.logout()¶
Log out the current user.
This deletes the
~/.lamin/current_user.envso that you’ll no longer be automatically authenticated in the environment.It keeps a copy as
~/.lamin/user--<user_handle>.envso you can easily switch between user profiles.See also
Logout via the CLI command
lamin logout, see here.
- lamindb.setup.init(*, storage='.', name=None, db=None, modules=None, **kwargs)¶
Init a LaminDB instance.
- Parameters:
storage (lamindb.core.types.UPathStr, default:
'.') – A local or remote folder ('s3://...'or'gs://...'). Defaults to current working directory.name (
str|None, default:None) – Instance name. If not passed, it will equal the folder name passed tostorage.db (
PostgresDsn|None, default:None) – Database connection URL. Defaults toNone, which implies an SQLite file in the storage location.modules (
str|None, default:None) – Comma-separated string of schema modules.**kwargs – Keyword arguments for low-level control.
- Return type:
None
See also
Init an instance for via the CLI, see here.
- lamindb.setup.disconnect(mute=False)¶
Clear default instance configuration.
Returns
Noneif succeeds, otherwise an exception is raised. :rtype:NoneSee also
Clear default instance configuration via the CLI, see here.
- lamindb.setup.delete(slug, force=False, require_empty=True)¶
Delete a LaminDB instance.
- Parameters:
slug (
str) – The instance slugaccount_handle/instance_nameor URL. If the instance is owned by you, it suffices to pass the instance name.force (
bool, default:False) – Whether to skip the confirmation prompt.require_empty (
bool, default:True) – Whether to check if the instance is empty before deleting.
- Return type:
int|None
See also
Delete an instance via the CLI, see here.
Modules & settings¶
Global |
|
Core setup library. |
|
|
Call Django commands. |
Errors. |
|
Types. |
Migration management¶
|
Manage database migrations. |