PyTiDB (pytidb) setup and usage for TiDB from Python. Covers connecting, table modeling (TableModel), CRUD, raw SQL, transactions, vector/full-text/hybrid search, auto-embedding, custom embedding functions, and reference templates/snippets (vector/hybrid/image) plus agent-oriented examples (RAG/memory/text2sql).
Use this skill to connect to TiDB from Python via pytidb, define tables, and build search / AI features on top.
pytidb (built on SQLAlchemy).Need to provision a TiDB Cloud cluster first? Use tidbx (TiDB X) for cluster lifecycle guidance.
.env) and document required variables.python -m venv .venv and pinned deps for reproducibility.extend_existing / open_table / if rows()==0 patterns).Each guide is a self-contained walkthrough with a checklist and phases:
guides/quickstart.md — one-file “connect → create table → insert → vector search”guides/search.md — vector / full-text / hybrid: when to use which, plus gotchasguides/demos.md — examples playbook (vector/hybrid/image)guides/agent-apps.md — agent-ish examples (RAG / memory / text2sql)guides/troubleshooting.md — connection, TLS, embedding, and index/search issuesguides/custom-embedding.md — implement a custom embedding function (example: BGE-M3)I’ll infer your intent (CRUD vs search vs “agent app”), then point you to the smallest guide and template set that gets you running.
Each template is a complete file you can copy into your project. Choose the smallest one that matches your goal.
templates/quickstart.py — minimal end-to-end: connect → create table → insert → vector searchtemplates/crud.py — basic table modeling + CRUD lifecycle (create/truncate/insert/query/update/delete)templates/auto_embedding.py — auto embedding with pluggable providers (env-driven)templates/vector_search.py — vector search example (optional metadata filter + threshold)templates/hybrid_search.py — hybrid search example (FullTextField + vector field) with fused scoringtemplates/image_search.py — image-to-image or text-to-image search (requires multimodal embedding + Pillow)templates/image_search_data_loader.py — loads Oxford Pets dataset into TiDB (used by image_search.py)templates/custom_embedding_function.py — example BaseEmbeddingFunction implementation (BGE-M3 via FlagEmbedding)templates/custom_embedding.py — uses the custom embedder with auto embedding + vector searchtemplates/rag.py — minimal RAG: retrieve via vector search, then generate via local LLM (Ollama via LiteLLM)templates/memory_lib.py — reusable “memory” library (extract facts → store → retrieve)templates/memory.py — CLI memory chat example using memory_lib.pytemplates/text2sql.py — interactive Text2SQL (generates SQL via OpenAI; asks before executing)scripts/validate_connection.py — quick connection + SELECT 1 smoke test (supports params or DATABASE_URL)tidbx — provision/manage TiDB Cloud (TiDB X) clustersI will:
DATABASE_URL).Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer