Run the development server
masterStart the local Django development server using uv run.
uv run python manage.py runserverrepository·master·Indexed 20 days ago
https://github.com/cmu-db/dbdb.ioDBDB.io is a 'Database of Databases' platform serving as a registry or catalog for database systems. Built with Django and PostgreSQL, it includes management tools for approving system versions, bulk-updating attributes and features, collecting repository statistics, and computing system embeddings using transformer models.
Start the local Django development server using uv run.
uv run python manage.py runserverTo deploy updates to the production machine, execute the deployment script. This script fetches changes, runs database migrations, and restarts the WSGI server.
deploy/update_dbdb_app.shIf you need to update local test data with current production data, use manage.py dumpdata.
Prerequisites:
db-web.tail5fc291.ts.net.DATABASE_URL in your .env file must point to the production database.This process dumps Feature, FeatureOption, Attribute, and AttributeOption rows into JSON files located in data/fixtures/.
# Features and feature options
uv run python manage.py dumpdata core.feature core.featureoption \
--indent 2 -o data/fixtures/core_features.json
# Attributes and attribute options
uv run python manage.py dumpdata core.attribute core.attributeoption \
--indent 2 -o data/fixtures/core_attributes.jsonUse manage.py loaddata to populate your local database with the standard set of test fixtures (admin users, core features, attributes, etc.).
uv run python manage.py loaddata adminuser testuser \
core_features core_attributes core_system core_savedsearchRun tests using manage.py test. The runner automatically creates and destroys a dedicated database named test_dbdb_io for every run.
Requirements:
PGUSER environment variable.dbdb.test_settings module is used to override production settings with local PostgreSQL parameters.PGUSER=<your-local-pg-user> uv run python manage.py test dbdb.core \
--settings=dbdb.test_settings --verbosity=2To install the necessary system dependencies and synchronize the Python environment using uv, run the following commands. Note that sudo is required for system package installation.
sudo apt-get install build-essential libffi-dev libpq-dev python3-dev postgresql-common-dev libcairo2
uv syncThe collect_repo_info command manages repository lifecycle through two mechanisms:
If a repository fails to provide valid data repeatedly, it is automatically disabled. Specifically, if the last _FAILED_DISABLE_THRESHOLD (set to 3) consecutive snapshots have a status of RepositorySnapshot.Status.FAILED, the RepositoryInfo.enabled flag is set to False.
If the --check-abandoned flag is provided, the command runs check_abandoned() for each system. This uses the REPOSITORY_INACTIVITY_DAYS setting to determine if a repository has had no activity for a sufficient period. If it has, the repository is marked as abandoned.
When the --check-resurrection flag is used, the command changes its behavior:
--check-resurrection is active and --check-abandoned is NOT active, the command skips snapshot collection for enabled repositories and focuses solely on scanning abandoned ones.SystemVersion for administrator review.If --check-abandoned is also enabled, the command performs standard snapshot collection and then checks for abandonment as part of the normal workflow.
The keyword positional argument determines which CitationUrl records are selected based on its format:
pk).url__icontains).The copy_attributes management command is used for data migration to move Tag, License, OperatingSystem, ProgrammingLanguage, and ProjectType rows into the Attribute and AttributeOption models. It also re-links existing SystemVersion Many-to-Many (M2M) relationships to the new attr_* fields.
To ensure data integrity, follow this specific run order:
manage.py migrate to apply migrations 0059 and 0060 (which add the Attribute/AttributeOption models and the sv_field/search_text fields).manage.py copy_attributes (use --dry-run to preview changes).manage.py migrate to apply migration 0061 (which removes old fields and renames the attr_* fields).--dry-run: Prints what would be done without writing any changes to the database. If used, all database operations are rolled back at the end of the command.# 1. Apply initial migrations
python manage.py migrate
# 2. Run the copy command (with dry-run to test)
python manage.py copy_attributes --dry-run
# 3. Apply final migrations
python manage.py migrateThe enrich_organization management command uses an LLM to automatically fill missing fields in Organization records. It can perform two main tasks: general field enrichment (description, stock symbols, etc.) and specific URL extraction (LinkedIn, Crunchbase) from the organization's homepage.
Workflow:
org_type, or by targeting organizations where a specific FIELD is currently empty.enrich mode (filling various fields), extract-urls mode (specifically looking for social/business URLs), or both.Important Note: If the organization type is COMPANY, the command may also attempt to find and update the full legal name (including suffixes like 'Inc.' or 'GmbH') and update the organization's slug accordingly.
# Example: Enrich organizations of type 'company' that are missing a 'description'
python manage.py enrich_organization --search-type company --missing description
# Example: Extract LinkedIn and Crunchbase URLs for a specific organization by slug
python manage.py enrich_organization my-org-slug --mode extract-urlsThe enrich_system command uses an LLM to automatically identify and fill missing information for a SystemVersion. It crawls known URLs (like the system's homepage or GitHub repository), passes the text to an LLM along with the project's taxonomy, and validates the results.
Key Behaviors:
SystemVersion with approved=False (a pending version) containing the suggested values.description, history)start_year, end_year)system_url, docs_url, blog_url, sourcerepo_url, wikipedia_url, twitter_url)project_types, licenses, oses, written_in, tags)fetch_url_metadata().python manage.py enrich_system <slug> [options]