Create - Existing DB
TL;DR - Create Project From Existing Database
The genai-logic create CLI command creates a customizable / executable API Logic Project from an existing database, providing:
-
A JSON:API - Endpoint for each table, with filtering, sorting, pagination, optimistic locking, including related data access, based on relationships in the models file (typically derived from foreign keys)
-
An Admin App - multi-page, multi-table, with automatic joins
The genai-logic genai CLI command creates a customizable / executable API Logic Project and a new database, from an NL prompt. For more information, see WebGenAI CLI.
Customize the project in your IDE to add custom endpoints, rules and Python for logic and security. Projects are fully configured for development (e.g. run configurations) and deployment (e.g., image creation, env variables).
genai-logic create (existing db)
The key genai-logic create options are:
-
--project_namedefines the directory created for your project -
--db_urlidentifies the database. Specify a SQLAlchemy url, or one of the preloaded sample database abbreviations
Discover other options with genai-logic create --help.
Discover other commands with genai-logic --help.
Create --from-model
In addition to creating projects from databases, you can also create them from SQLAlchemy models. For example:
- Copilot can produce models
- Many Python programmers prefer to use SQLAlchemy as their database tool
genai-logic genai (new db)
The key genai-logic genai options are:
-
--usingidentifies the prompt file name -
--project_namedefines the directory created for your project (optional)
Discover other options with genai-logic create --help.
Discover other commands with genai-logic --help.
The key files that drive execution are described below. Note they are models - instead of lengthy generated code (what), they are Python declarations of how.
Using AI Assistant
In addition to CLI commands, you might it simpler to use your AI Assistant (e.g., Copilot).
CLI Shortcut (Manager)
Copilot in the Manager will create run the CLI for you with commands such as: