CLI
Managing Tenants
Nile provides built-in multi-tenancy support. This guide covers all tenant management commands and their usage.
Available commands:
list
- View all tenantscreate
- Create a new tenantdelete
- Remove a tenantupdate
- Modify tenant details
Prerequisites
Before managing tenants, ensure you have:
- Selected a workspace
- Selected a database
- Authenticated with Nile
Prerequisites
Listing Tenants
The list
command shows all tenants in your database.
Options
Flag | Description | Default |
---|---|---|
--format | Output format (human, json, csv) | human |
--workspace | Workspace containing the database | Current workspace |
--db | Database to list tenants from | Current database |
Examples
List Examples
Creating Tenants
The create
command adds a new tenant to your database.
Required Options
Flag | Description |
---|---|
--name | Name of the tenant |
Additional Options
Flag | Description | Default |
---|---|---|
--id | Custom ID for the tenant | Auto-generated |
--format | Output format (human, json, csv) | human |
--workspace | Workspace containing the database | Current workspace |
--db | Database to create tenant in | Current database |
Examples
Create Examples
Updating Tenants
The update
command modifies existing tenant details.
Required Options
Flag | Description |
---|---|
--id | ID of the tenant to update |
--new_name | New name for the tenant |
Additional Options
Flag | Description | Default |
---|---|---|
--format | Output format (human, json, csv) | human |
--workspace | Workspace containing the database | Current workspace |
--db | Database containing the tenant | Current database |
Examples
Update Examples
Deleting Tenants
The delete
command removes a tenant from your database.
Required Options
Flag | Description |
---|---|
--id | ID of the tenant to delete |
Additional Options
Flag | Description | Default |
---|---|---|
--force | Skip confirmation prompt | false |
--workspace | Workspace containing the database | Current workspace |
--db | Database containing the tenant | Current database |
Examples
Delete Examples
Common Workflows
Setting Up Initial Tenants
Initial Setup
Tenant Maintenance
Maintenance
Bulk Operations
Bulk Operations
Common Issues
Tenant Not Found
When tenant doesn’t exist:
Not Found
Database Not Selected
When database isn’t specified:
No Database
Duplicate Tenant ID
When creating tenant with existing ID:
Duplicate ID
Best Practices
-
Naming Conventions: Use clear, consistent tenant names:
-
Regular Verification: Periodically verify tenant list:
-
Backup Before Delete: List tenant details before deletion:
Related Commands
nile db psql
- Connect to tenant’s databasenile db connectionstring
- Get tenant-specific connectionnile config
- Configure CLI settingsnile workspace
- Manage workspaces
Was this page helpful?