The Database Connector ORM (Object-Relational Mapping) plugin for CodeGen-X is designed to facilitate seamless integration between your application and the database. This plugin simplifies database operations, such as reading, writing, updating, and deleting data, by using high-level abstractions that map database tables to object-oriented models.
Features
- Easy Database Operations: Perform CRUD operations with ease using ORM methods.
- Database Agnostic: Supports various databases like MySQL, PostgreSQL, SQLite, etc.
- Customizable: Configure the plugin to suit your specific database needs.
Getting Started
To use the Database Connector ORM plugin, follow these steps:
- Install the Plugin: Navigate to the plugin manager in CodeGen-X and install the "Database Connector ORM" plugin.
- Configure Database Connection: Set up the database connection details in the plugin settings.
- Define Models: Create ORM models that represent your database tables.
- Use ORM Methods: Utilize the ORM methods to interact with the database.
Example Usage
Here's an example of how you can use the ORM methods to fetch data from a database table:
# Import the ORM module
from codgenx.orm import ORM
# Create an ORM instance
orm = ORM()
# Fetch data from the "users" table
users = orm.fetch_all("users")
# Print the fetched data
for user in users:
print(user.name, user.email)
Resources
For more information on the Database Connector ORM plugin, please visit the official documentation.
Database Connection Example