text stringlengths 0 5.52k |
|---|
INSERT INTO users (email, password_hash, first_name, last_name) |
VALUES |
('alice.johnson@techcorp.com', '$2b$12$hashedpassword1', 'Alice', 'Johnson'), |
('bob.smith@techcorp.com', '$2b$12$hashedpassword2', 'Bob', 'Smith'), |
('carol.williams@techcorp.com', '$2b$12$hashedpassword3', 'Carol', 'Williams'); |
INSERT INTO projects (name, description, owner_id, status, start_date, deadline, budget) |
VALUES |
('API Gateway Refactor', 'Migrate legacy API gateway to Kong', 1, 'active', '2024-01-15', '2024-06-30', 150000.00), |
('Mobile App Redesign', 'Redesign iOS/Android apps with new design system', 2, 'planning', '2024-03-01', '2024-09-30', 250000.00); |
def get_user_projects(user_id: int, status: Optional[str] = None) -> List[Project]: |
"""Retrieve all projects for a user with optional status filter.""" |
query = """ |
SELECT p.* FROM projects p |
JOIN project_members pm ON p.id = pm.project_id |
WHERE pm.user_id = %s |
""" |
params = [user_id] |
if status: |
query += " AND p.status = %s" |
params.append(status) |
query += " ORDER BY p.updated_at DESC" |
return db.execute(query, params).fetchall() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.