SQL Data Store
What's a SQL Data Store?
If you're familiar with traditional databases or need to work with structured, tabular data, SQL datastores are your go-to choice. These datastores provide traditional relational database functionality with support for structured data operations. They are suitable for:
Structured data with well-defined schemas
Transactional operations requiring ACID compliance
Complex queries with joins and aggregations
Reporting and analytics on structured datasets
Available Implementations:
SQLAlchemy SQL Data Store
Installation
# you can use a Conda environment
pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/ gllm-datastore# you can use a Conda environment
pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/ gllm-datastore# you can use a Conda environment
FOR /F "tokens=*" %T IN ('gcloud auth print-access-token') DO pip install --extra-index-url "https://oauth2accesstoken:%T@glsdk.gdplabs.id/gen-ai-internal/simple/" "gllm-datastore"Managing Data
The SQL Data Store provides comprehensive CRUD (Create, Read, Update, Delete) operations for managing structured data. Here's how to use each operation effectively:
Create
The create() method is used to insert new records into the database. It accepts either a single model instance or a list of model instances as parameters.
Read
The read() method retrieves data from the database using structured queries with optional filters and options. It provides a type-safe interface for querying data.
Update
The update() method modifies existing records in the database. It requires a model class, update values, and optional filters to specify which records to update.
Delete
The delete() method removes records from the database. It requires a model class and filters to specify which records to delete, with safety measures to prevent accidental deletion of all records.
Last updated