<@ULVA73B9P> on running prefect server database re...
# marvin-ai
k
@Marvin on running prefect server database reset -y it completed wiped off all the objects from the prefect db in my postgres, however there were certain things which i needed such as default blocks under the block section, how can i retreive them?
m
thought for 303.9 seconds
Got it — a
prefect server database reset -y
drops all tables, which removes both configured blocks and the registered block types. Here’s how to get the default block types back. Quickest option (auto-register on startup) - If you restart the Prefect server, it will auto-register the core block types during startup.
Copy code
prefect server start
Manual re-registration (no server restart needed) - Register Prefect’s built-in blocks (Secret, Webhook, notifications, etc.):
Copy code
prefect block register -m prefect.blocks
- Register the core filesystem blocks (e.g., LocalFileSystem):
Copy code
prefect block register -m prefect.filesystems
- Verify they’re present:
Copy code
prefect block type ls
If you use integrations (AWS/GCP/etc.) - Re-register blocks from each collection you use. Example for AWS (ensures extras are available at runtime):
Copy code
uv run --with 'prefect[aws]' prefect block register -m prefect_aws.credentials
Important note about configured blocks - A DB reset permanently deletes your configured block instances (e.g., saved Secrets, FileSystems). Those can’t be recovered without a backup — you’ll need to recreate them in the UI or via code. References - Blocks (Prefect docs) If you’re still not seeing the blocks after running the above, let me know which ones are missing and I’ll help you target the right module(s) to register.
k
@Marvin i have no block type ls even on restarting prefect.blocks.secret.dbt-git-repo-token how can i create his block
m
thought for 88.0 seconds
It sounds like you’re trying to recreate a Secret block instance named “dbt-git-repo-token”. After a DB reset you need to do two things: 1) re-register the Secret block type, and 2) recreate the block instance (its value is gone and must be re-entered). Also, the reference should be secret/dbt-git-repo-token (not prefect.blocks.secret.dbt-git-repo-token). Step 0: Make sure your CLI is pointed at the right API - Run:
Copy code
prefect config view
- Ensure api.url points to your server (e.g., http://127.0.0.1:4200/api). If it points elsewhere, the commands below will affect the wrong backend. Step 1: Re-register the Secret block type - Either register just system blocks:
Copy code
prefect block register -m prefect.blocks.system
- Or register all built-in blocks (system + notifications):
Copy code
prefect block register -m prefect.blocks
- Verify:
Copy code
prefect block type ls
Step 2: Recreate your Secret block instance - Easiest is via Python:
Copy code
from prefect.blocks.system import Secret

Secret(value="YOUR_TOKEN_VALUE").save("dbt-git-repo-token", overwrite=True)
# Later, to use it:
# token = Secret.load("dbt-git-repo-token").get()
Alternative via UI - Run:
Copy code
prefect block create
- Follow the link to the UI, choose “Secret”, name it dbt-git-repo-token, and enter the value. Notes - A DB reset permanently deletes configured blocks; there’s no recovery without a backup. - The correct identifier for the block you’re creating/using is secret/dbt-git-repo-token. Docs - Blocks (how to create/use blocks) - CLI: prefect block