Skip to content

docs: update Python quickstart with Pydantic models for type-safe data access#2788

Open
ChiragAgg5k wants to merge 2 commits intomainfrom
update-python-quickstart-pydantic
Open

docs: update Python quickstart with Pydantic models for type-safe data access#2788
ChiragAgg5k wants to merge 2 commits intomainfrom
update-python-quickstart-pydantic

Conversation

@ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Mar 9, 2026

Summary

This PR updates the Python quick-start documentation to use Pydantic models for type-safe data access with the Appwrite Python SDK.

Changes Made

  • Step 5: Added Pydantic Todo model definition for type-safe data access
  • Step 6: Updated seed_database() to create Todo model instances and use .model_dump() for serialization
  • Step 7: Updated all list_rows() calls to use model_type=Todo parameter for type-safe row retrieval
  • Fixed dictionary access (todo['title']) to attribute access (todo.data.title)
  • Updated pip install command from pinned version to latest (pip install appwrite)
  • Added uv add appwrite as an alternative installation method

Benefits

  • Demonstrates modern Python SDK usage with Pydantic models
  • Provides IDE autocomplete and type checking for row data
  • Makes the quick-start guide more aligned with SDK 16.0.0+ capabilities

Related Issue

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Test Plan

  • Manual testing completed
  • Documentation changes reviewed for accuracy

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my changes
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Summary by CodeRabbit

  • Documentation
    • Updated examples to use consistent property-based ID access in transaction and database snippets across languages.
    • Enhanced Python quick-start with a typed Todo model and type-safe data access.
    • Revised SDK version tables to reflect newer, stable SDK releases and removed several beta markers for clarity.

…a access

- Add Pydantic Todo model for type-safe row operations
- Update seed_database() to use model instances with model_dump()
- Update list_rows() calls to use model_type parameter
- Fix dictionary access to use attribute access (todo.data.title)
- Update pip install command to use latest version
- Add uv install alternative
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 9, 2026

Walkthrough

This pull request updates documentation examples across multiple pages: it replaces bracket notation with dot notation for transaction IDs (e.g., tx['$id']tx.id/tx.Id) in database/operator/transaction snippets; refactors the Python quickstart to add a Pydantic Todo model and switches from dict-based IDs and rows to attribute access and model-based serialization; updates package install instructions in the Python quickstart; and updates SDK version entries across the SDKs page tables to newer release versions.

Estimated code review effort

src/routes/docs/products/databases/operators/+page.markdoc
🎯 2 (Simple) | ⏱️ ~8 minutes

src/routes/docs/products/databases/transactions/+page.markdoc
🎯 2 (Simple) | ⏱️ ~8 minutes

src/routes/docs/quick-starts/python/+page.markdoc
🎯 4 (Complex) | ⏱️ ~45 minutes

src/routes/docs/sdks/+page.markdoc
🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title focuses on the Python quickstart Pydantic updates, but the changeset includes unrelated updates to SDK versions, transaction operator docs, and transaction documentation across multiple files. Revise the title to reflect the broader scope, such as 'docs: update SDKs, Python quickstart with Pydantic models, and transaction examples' or use a more general title like 'docs: update documentation and SDK versions'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-python-quickstart-pydantic

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/routes/docs/quick-starts/python/`+page.markdoc:
- Around line 225-265: The three functions get_todos, get_completed_todos, and
get_incomplete_todos use an unsupported model_type=Todo in tablesDB.list_rows
and then access todo.data.title which will fail; remove the model_type=Todo
argument from each list_rows call and change the item field access to use the
returned dict keys (e.g., todo['title'], todo['description'],
todo['isComplete']) instead of todo.data.* while keeping the same queries and
pagination options.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: be06d40f-42e1-48ad-b512-198409bac46f

📥 Commits

Reviewing files that changed from the base of the PR and between 3999450 and b46b2c7.

📒 Files selected for processing (3)
  • src/routes/docs/products/databases/operators/+page.markdoc
  • src/routes/docs/products/databases/transactions/+page.markdoc
  • src/routes/docs/quick-starts/python/+page.markdoc

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/routes/docs/sdks/`+page.markdoc:
- Around line 23-50: The docs list incorrect versions for the Python and Go
SDKs; locate the Python SDK entry showing "Python SDK `16.0.0`" and update the
version string to "v15.3.0", and locate the Go SDK entry showing "Go SDK
`1.0.0`" and update it to "v0.17.0"; ensure the markdown/markdoc entries (the
SDK name lines and any adjacent link references) are updated consistently so the
displayed versions match the GitHub releases and then save/commit the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 003a65e8-1df5-4d05-a2e2-0322c9ebff33

📥 Commits

Reviewing files that changed from the base of the PR and between b46b2c7 and 79a6208.

📒 Files selected for processing (1)
  • src/routes/docs/sdks/+page.markdoc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant