@caddis/cli 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -16
- package/bundles/antigravity-plugin-extras/plugin.json +5 -0
- package/bundles/antigravity-plugin-extras/skills/_registry.md +154 -0
- package/bundles/antigravity-plugin-extras/skills/agent-md-refactor/SKILL.md +356 -0
- package/bundles/antigravity-plugin-extras/skills/agent-orchestration/SKILL.md +517 -0
- package/bundles/antigravity-plugin-extras/skills/algorithmic-art/SKILL.md +293 -0
- package/bundles/antigravity-plugin-extras/skills/anchor-review/SKILL.md +135 -0
- package/bundles/antigravity-plugin-extras/skills/api-client-patterns/SKILL.md +367 -0
- package/bundles/antigravity-plugin-extras/skills/architecture-design/SKILL.md +244 -0
- package/bundles/antigravity-plugin-extras/skills/architecture-diagram/SKILL.md +156 -0
- package/bundles/antigravity-plugin-extras/skills/architecture-document/SKILL.md +321 -0
- package/bundles/antigravity-plugin-extras/skills/artifacts-builder/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/artifacts-builder/SKILL.md +74 -0
- package/bundles/antigravity-plugin-extras/skills/artifacts-builder/scripts/bundle-artifact.sh +54 -0
- package/bundles/antigravity-plugin-extras/skills/artifacts-builder/scripts/init-artifact.sh +322 -0
- package/bundles/antigravity-plugin-extras/skills/artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/bundles/antigravity-plugin-extras/skills/ascii-art/SKILL.md +144 -0
- package/bundles/antigravity-plugin-extras/skills/asking-questions/SKILL.md +81 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/SKILL.md +118 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/cross-service/credential-management.md +450 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/browser/README.md +363 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/code-interpreter/README.md +232 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/gateway/README.md +100 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/gateway/deploy-template.sh +117 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/gateway/deployment-strategies.md +416 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/gateway/troubleshooting-guide.md +384 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/gateway/validate-deployment.sh +186 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/identity/README.md +186 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/memory/README.md +253 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/observability/README.md +517 -0
- package/bundles/antigravity-plugin-extras/skills/aws-agentic-ai/services/runtime/README.md +215 -0
- package/bundles/antigravity-plugin-extras/skills/aws-cdk-development/SKILL.md +279 -0
- package/bundles/antigravity-plugin-extras/skills/aws-cdk-development/references/cdk-patterns.md +431 -0
- package/bundles/antigravity-plugin-extras/skills/aws-cdk-development/scripts/validate-stack.sh +240 -0
- package/bundles/antigravity-plugin-extras/skills/aws-cost-operations/SKILL.md +318 -0
- package/bundles/antigravity-plugin-extras/skills/aws-cost-operations/references/cloudwatch-alarms.md +567 -0
- package/bundles/antigravity-plugin-extras/skills/aws-cost-operations/references/operations-patterns.md +394 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/SKILL.md +758 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/references/deployment-best-practices.md +830 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/references/eda-patterns.md +1002 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/references/observability-best-practices.md +770 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/references/performance-optimization.md +671 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/references/security-best-practices.md +625 -0
- package/bundles/antigravity-plugin-extras/skills/aws-serverless-eda/references/serverless-patterns.md +838 -0
- package/bundles/antigravity-plugin-extras/skills/backend-to-frontend-handoff/SKILL.md +139 -0
- package/bundles/antigravity-plugin-extras/skills/banner-design/SKILL.md +188 -0
- package/bundles/antigravity-plugin-extras/skills/brand-design/SKILL.md +298 -0
- package/bundles/antigravity-plugin-extras/skills/brand-guidelines/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/brand-guidelines/SKILL.md +118 -0
- package/bundles/antigravity-plugin-extras/skills/brand-voice/SKILL.md +93 -0
- package/bundles/antigravity-plugin-extras/skills/building-ai-agent-on-cloudflare/SKILL.md +392 -0
- package/bundles/antigravity-plugin-extras/skills/building-ai-agent-on-cloudflare/references/agent-patterns.md +461 -0
- package/bundles/antigravity-plugin-extras/skills/building-ai-agent-on-cloudflare/references/examples.md +188 -0
- package/bundles/antigravity-plugin-extras/skills/building-ai-agent-on-cloudflare/references/state-patterns.md +360 -0
- package/bundles/antigravity-plugin-extras/skills/building-ai-agent-on-cloudflare/references/troubleshooting.md +362 -0
- package/bundles/antigravity-plugin-extras/skills/building-mcp-server-on-cloudflare/SKILL.md +266 -0
- package/bundles/antigravity-plugin-extras/skills/building-mcp-server-on-cloudflare/references/examples.md +115 -0
- package/bundles/antigravity-plugin-extras/skills/building-mcp-server-on-cloudflare/references/oauth-setup.md +338 -0
- package/bundles/antigravity-plugin-extras/skills/building-mcp-server-on-cloudflare/references/troubleshooting.md +317 -0
- package/bundles/antigravity-plugin-extras/skills/caching-patterns/SKILL.md +385 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/SKILL.md +91 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
- package/bundles/antigravity-plugin-extras/skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
- package/bundles/antigravity-plugin-extras/skills/changelog-generator/SKILL.md +105 -0
- package/bundles/antigravity-plugin-extras/skills/code-explainer/SKILL.md +91 -0
- package/bundles/antigravity-plugin-extras/skills/competitive-ads-extractor/SKILL.md +294 -0
- package/bundles/antigravity-plugin-extras/skills/component-testing/SKILL.md +310 -0
- package/bundles/antigravity-plugin-extras/skills/content-research-writer/SKILL.md +539 -0
- package/bundles/antigravity-plugin-extras/skills/cross-review/SKILL.md +51 -0
- package/bundles/antigravity-plugin-extras/skills/data-analysis/SKILL.md +111 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/README.md +248 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/SKILL.md +203 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/adapter.py.template +44 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/api-router.py.template +43 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/contract-test.py.template +384 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/display-dto.py.template +39 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/frontend-service.ts.template +46 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/frontend-types.ts.template +38 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/ingestion-model.py.template +42 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/mapping-doc.md.template +46 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/normalizer.py.template +48 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/prompts/extract_requirements.md +36 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/prompts/extract_ui_demand.md +35 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/prompts/reconcile_mapping.md +66 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/assets/query-catalog.md.template +62 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/references/consumer-driven-contracts.md +131 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/references/drift-check-catalog.md +305 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/references/layer-responsibilities.md +333 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/discover_connections.py +170 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/discover_sources.py +161 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/drift_check.py +171 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/extract_schema.py +1363 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/generate_gap_report.py +81 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/generate_mapping_doc.py +294 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/ts_dto_compare.py +214 -0
- package/bundles/antigravity-plugin-extras/skills/data-contract-pipeline/scripts/validate_lineage.py +51 -0
- package/bundles/antigravity-plugin-extras/skills/data-loader/SKILL.md +753 -0
- package/bundles/antigravity-plugin-extras/skills/data-validation/SKILL.md +220 -0
- package/bundles/antigravity-plugin-extras/skills/db-testing/SKILL.md +117 -0
- package/bundles/antigravity-plugin-extras/skills/deploy-local/SKILL.md +259 -0
- package/bundles/antigravity-plugin-extras/skills/design-md/SKILL.md +167 -0
- package/bundles/antigravity-plugin-extras/skills/design-system-tokens/SKILL.md +240 -0
- package/bundles/antigravity-plugin-extras/skills/design-system-tokens/references/DESIGN-SYSTEM-TEMPLATE.md +577 -0
- package/bundles/antigravity-plugin-extras/skills/developer-growth-analysis/SKILL.md +323 -0
- package/bundles/antigravity-plugin-extras/skills/doc-coauthoring/SKILL.md +378 -0
- package/bundles/antigravity-plugin-extras/skills/documentation-analyzer/SKILL.md +78 -0
- package/bundles/antigravity-plugin-extras/skills/domain-name-brainstormer/SKILL.md +213 -0
- package/bundles/antigravity-plugin-extras/skills/enterprise-dashboard-aesthetic-system/SKILL.md +120 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/SKILL.md +193 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/references/element-types.md +497 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/references/excalidraw-schema.md +356 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/references/reliable-diagrams.md +115 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/scripts/README.md +60 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/scripts/add-arrow.py +354 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/scripts/add-icon-to-diagram.py +412 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/scripts/split-excalidraw-library.py +183 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/business-flow-swimlane-template.excalidraw +334 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/class-diagram-template.excalidraw +558 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/data-flow-diagram-template.excalidraw +279 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/er-diagram-template.excalidraw +662 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/flowchart-template.excalidraw +179 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/mindmap-template.excalidraw +244 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/relationship-template.excalidraw +145 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/reliable-flowchart.excalidraw +1 -0
- package/bundles/antigravity-plugin-extras/skills/excalidraw/templates/sequence-diagram-template.excalidraw +509 -0
- package/bundles/antigravity-plugin-extras/skills/file-organizer/SKILL.md +434 -0
- package/bundles/antigravity-plugin-extras/skills/game-changing-features/README.md +221 -0
- package/bundles/antigravity-plugin-extras/skills/game-changing-features/SKILL.md +265 -0
- package/bundles/antigravity-plugin-extras/skills/github-issues/SKILL.md +359 -0
- package/bundles/antigravity-plugin-extras/skills/github-issues/references/templates.md +90 -0
- package/bundles/antigravity-plugin-extras/skills/golden-nuggets/SKILL.md +192 -0
- package/bundles/antigravity-plugin-extras/skills/humanizer/SKILL.md +194 -0
- package/bundles/antigravity-plugin-extras/skills/image-enhancer/SKILL.md +100 -0
- package/bundles/antigravity-plugin-extras/skills/intent-writer/SKILL.md +201 -0
- package/bundles/antigravity-plugin-extras/skills/internal-comms/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/internal-comms/SKILL.md +124 -0
- package/bundles/antigravity-plugin-extras/skills/internal-comms/examples/3p-updates.md +47 -0
- package/bundles/antigravity-plugin-extras/skills/internal-comms/examples/company-newsletter.md +65 -0
- package/bundles/antigravity-plugin-extras/skills/internal-comms/examples/faq-answers.md +30 -0
- package/bundles/antigravity-plugin-extras/skills/internal-comms/examples/general-comms.md +16 -0
- package/bundles/antigravity-plugin-extras/skills/invoice-organizer/SKILL.md +447 -0
- package/bundles/antigravity-plugin-extras/skills/jira-issues/SKILL.md +182 -0
- package/bundles/antigravity-plugin-extras/skills/job-application/SKILL.md +188 -0
- package/bundles/antigravity-plugin-extras/skills/lead-research-assistant/SKILL.md +200 -0
- package/bundles/antigravity-plugin-extras/skills/llm-application-dev/SKILL.md +217 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/SKILL.md +100 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/references/evaluation.md +602 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/references/mcp_best_practices.md +915 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/references/node_mcp_server.md +916 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/references/python_mcp_server.md +752 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/scripts/connections.py +151 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/bundles/antigravity-plugin-extras/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/bundles/antigravity-plugin-extras/skills/meeting-insights-analyzer/SKILL.md +328 -0
- package/bundles/antigravity-plugin-extras/skills/monorepo/SKILL.md +267 -0
- package/bundles/antigravity-plugin-extras/skills/naming-analyzer/SKILL.md +376 -0
- package/bundles/antigravity-plugin-extras/skills/nextjs-app-router/SKILL.md +271 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/AUTHENTICATION.md +154 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/SKILL.md +270 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/references/api_reference.md +309 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/references/troubleshooting.md +376 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/references/usage_patterns.md +338 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/__init__.py +81 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/ask_question.py +256 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/auth_manager.py +358 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/browser_session.py +255 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/browser_utils.py +107 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/cleanup_manager.py +302 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/config.py +44 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/notebook_manager.py +410 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/run.py +102 -0
- package/bundles/antigravity-plugin-extras/skills/notebooklm/scripts/setup_environment.py +204 -0
- package/bundles/antigravity-plugin-extras/skills/observability/SKILL.md +371 -0
- package/bundles/antigravity-plugin-extras/skills/onboard-project/SKILL.md +192 -0
- package/bundles/antigravity-plugin-extras/skills/performance-testing/SKILL.md +226 -0
- package/bundles/antigravity-plugin-extras/skills/pipeline-state/SKILL.md +208 -0
- package/bundles/antigravity-plugin-extras/skills/plantuml/SKILL.md +228 -0
- package/bundles/antigravity-plugin-extras/skills/popular-web-designs/SKILL.md +142 -0
- package/bundles/antigravity-plugin-extras/skills/popular-web-designs/templates/linear.app.md +196 -0
- package/bundles/antigravity-plugin-extras/skills/popular-web-designs/templates/stripe.md +214 -0
- package/bundles/antigravity-plugin-extras/skills/popular-web-designs/templates/vercel.md +218 -0
- package/bundles/antigravity-plugin-extras/skills/prd-to-code/SKILL.md +127 -0
- package/bundles/antigravity-plugin-extras/skills/raffle-winner-picker/SKILL.md +159 -0
- package/bundles/antigravity-plugin-extras/skills/react-useeffect/README.md +320 -0
- package/bundles/antigravity-plugin-extras/skills/react-useeffect/SKILL.md +53 -0
- package/bundles/antigravity-plugin-extras/skills/react-useeffect/alternatives.md +258 -0
- package/bundles/antigravity-plugin-extras/skills/react-useeffect/anti-patterns.md +290 -0
- package/bundles/antigravity-plugin-extras/skills/receiving-code-review/SKILL.md +213 -0
- package/bundles/antigravity-plugin-extras/skills/relay/SKILL.md +246 -0
- package/bundles/antigravity-plugin-extras/skills/requesting-code-review/SKILL.md +105 -0
- package/bundles/antigravity-plugin-extras/skills/requesting-code-review/code-reviewer.md +146 -0
- package/bundles/antigravity-plugin-extras/skills/responsive-mobile-native/SKILL.md +350 -0
- package/bundles/antigravity-plugin-extras/skills/responsive-mobile-native/references/pwa-checklist.md +226 -0
- package/bundles/antigravity-plugin-extras/skills/responsive-mobile-native/references/touch-and-interaction.md +265 -0
- package/bundles/antigravity-plugin-extras/skills/responsive-mobile-native/references/transformation-catalogue.md +326 -0
- package/bundles/antigravity-plugin-extras/skills/schema-migration/SKILL.md +275 -0
- package/bundles/antigravity-plugin-extras/skills/setup-project-ai/SKILL.md +120 -0
- package/bundles/antigravity-plugin-extras/skills/shadcn-radix/SKILL.md +330 -0
- package/bundles/antigravity-plugin-extras/skills/sketch/SKILL.md +104 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/SKILL.md +646 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/color_palettes.py +302 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/easing.py +230 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/frame_composer.py +469 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/gif_builder.py +246 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/typography.py +357 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/validators.py +264 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/core/visual_effects.py +494 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/requirements.txt +4 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/bounce.py +106 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/explode.py +331 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/fade.py +329 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/flip.py +291 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/kaleidoscope.py +211 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/morph.py +329 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/move.py +293 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/pulse.py +268 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/shake.py +127 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/slide.py +291 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/spin.py +269 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/wiggle.py +300 -0
- package/bundles/antigravity-plugin-extras/skills/slack-gif-creator/templates/zoom.py +312 -0
- package/bundles/antigravity-plugin-extras/skills/slides/SKILL.md +38 -0
- package/bundles/antigravity-plugin-extras/skills/state-tracking/SKILL.md +131 -0
- package/bundles/antigravity-plugin-extras/skills/streamlit-dev/SKILL.md +268 -0
- package/bundles/antigravity-plugin-extras/skills/svg-create/SKILL.md +251 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/SKILL.md +59 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/theme-showcase.pdf +0 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/arctic-frost.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/botanical-garden.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/desert-rose.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/forest-canopy.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/golden-hour.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/midnight-galaxy.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/modern-minimalist.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/ocean-depths.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/sunset-boulevard.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/theme-factory/themes/tech-innovation.md +19 -0
- package/bundles/antigravity-plugin-extras/skills/ui-styling-patterns/LICENSE.txt +202 -0
- package/bundles/antigravity-plugin-extras/skills/ui-styling-patterns/SKILL.md +320 -0
- package/bundles/antigravity-plugin-extras/skills/ui-testing/SKILL.md +660 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/SKILL.md +660 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/_sync_all.py +414 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/app-interface.csv +31 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/charts.csv +26 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/colors.csv +162 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/design.csv +1776 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/draft.csv +1779 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/google-fonts.csv +1924 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/icons.csv +106 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/landing.csv +35 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/products.csv +162 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/react-performance.csv +45 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/styles.csv +85 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/typography.csv +74 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/ui-reasoning.csv +162 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/data/ux-guidelines.csv +100 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/scripts/core.py +247 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/scripts/design_system.py +1067 -0
- package/bundles/antigravity-plugin-extras/skills/ui-ux-intelligence/scripts/search.py +114 -0
- package/bundles/antigravity-plugin-extras/skills/understand-anything/SKILL.md +140 -0
- package/bundles/antigravity-plugin-extras/skills/understand-anything/references/commands.md +252 -0
- package/bundles/antigravity-plugin-extras/skills/understand-anything/references/graph-schema.md +116 -0
- package/bundles/antigravity-plugin-extras/skills/understand-anything/references/pipeline.md +331 -0
- package/bundles/antigravity-plugin-extras/skills/update-readme/SKILL.md +74 -0
- package/bundles/antigravity-plugin-extras/skills/verification-loop/SKILL.md +209 -0
- package/bundles/antigravity-plugin-extras/skills/video-downloader/SKILL.md +107 -0
- package/bundles/antigravity-plugin-extras/skills/webapp-development/SKILL.md +288 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/SKILL.md +339 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/agents/agent-interface.md +175 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/html.md +384 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/nlp-keywords.md +127 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/palettes.md +149 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/python.md +249 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/react.md +427 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/shapes.md +135 -0
- package/bundles/antigravity-plugin-extras/skills/word-cloud/references/stopwords.md +115 -0
- package/bundles/antigravity-plugin-extras/skills/youtube-transcript/SKILL.md +416 -0
- package/bundles/manifest.json +2 -1
- package/dist/cli.js +166 -37
- package/package.json +1 -1
|
@@ -0,0 +1,753 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: data-loader
|
|
3
|
+
context: fork
|
|
4
|
+
description: Load data from files (Excel, JSON, CSV) into databases. Use when user needs to import data files into any database system. Database-agnostic - supports SQL Server, PostgreSQL, MySQL, SQLite, and others.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Data Loader Skill
|
|
8
|
+
|
|
9
|
+
Systematically load data from various file formats into database tables with validation, transformation, and error handling.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
|
|
13
|
+
Activate when:
|
|
14
|
+
- User says "load this Excel/JSON/CSV into the database"
|
|
15
|
+
- User provides a data file for import
|
|
16
|
+
- User needs to populate tables from external sources
|
|
17
|
+
- User asks about ETL or data ingestion
|
|
18
|
+
- User mentions "import data" or "data loading"
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Supported Formats
|
|
23
|
+
|
|
24
|
+
| Format | Extensions | Library |
|
|
25
|
+
|--------|-----------|---------|
|
|
26
|
+
| Excel | `.xlsx`, `.xls` | `openpyxl`, `xlrd` |
|
|
27
|
+
| JSON | `.json` | `json` (built-in) |
|
|
28
|
+
| CSV | `.csv` | `pandas` |
|
|
29
|
+
| Parquet | `.parquet` | `pyarrow` |
|
|
30
|
+
| XML | `.xml` | `lxml` |
|
|
31
|
+
|
|
32
|
+
## Supported Databases
|
|
33
|
+
|
|
34
|
+
| Database | Connection String Pattern | Driver |
|
|
35
|
+
|----------|--------------------------|--------|
|
|
36
|
+
| SQL Server | `mssql+pyodbc://...` | `pyodbc` |
|
|
37
|
+
| PostgreSQL | `postgresql://...` | `psycopg2` |
|
|
38
|
+
| MySQL | `mysql+pymysql://...` | `pymysql` |
|
|
39
|
+
| SQLite | `sqlite:///...` | Built-in |
|
|
40
|
+
| Oracle | `oracle+cx_oracle://...` | `cx_Oracle` |
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Phase 1: Source Discovery
|
|
45
|
+
|
|
46
|
+
### Objectives
|
|
47
|
+
- Identify source file(s) and format
|
|
48
|
+
- Understand data structure and schema
|
|
49
|
+
- Assess data quality and volume
|
|
50
|
+
|
|
51
|
+
### Actions
|
|
52
|
+
|
|
53
|
+
1. **Identify source files**
|
|
54
|
+
```python
|
|
55
|
+
from pathlib import Path
|
|
56
|
+
import pandas as pd
|
|
57
|
+
|
|
58
|
+
# Find data files
|
|
59
|
+
source_path = Path("data/")
|
|
60
|
+
files = list(source_path.glob("*.xlsx")) + \
|
|
61
|
+
list(source_path.glob("*.json")) + \
|
|
62
|
+
list(source_path.glob("*.csv"))
|
|
63
|
+
|
|
64
|
+
print(f"Found {len(files)} data files:")
|
|
65
|
+
for f in files:
|
|
66
|
+
print(f" - {f.name} ({f.stat().st_size / 1024:.1f} KB)")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. **Load and inspect data**
|
|
70
|
+
```python
|
|
71
|
+
def load_source_file(file_path: Path) -> pd.DataFrame:
|
|
72
|
+
"""Load data from various formats into DataFrame."""
|
|
73
|
+
suffix = file_path.suffix.lower()
|
|
74
|
+
|
|
75
|
+
if suffix in ['.xlsx', '.xls']:
|
|
76
|
+
# Excel - may have multiple sheets
|
|
77
|
+
xlsx = pd.ExcelFile(file_path)
|
|
78
|
+
print(f"Excel sheets: {xlsx.sheet_names}")
|
|
79
|
+
df = pd.read_excel(file_path, sheet_name=0) # First sheet
|
|
80
|
+
|
|
81
|
+
elif suffix == '.json':
|
|
82
|
+
# JSON - handle nested structures
|
|
83
|
+
df = pd.read_json(file_path)
|
|
84
|
+
# For nested JSON:
|
|
85
|
+
# df = pd.json_normalize(json.load(open(file_path)))
|
|
86
|
+
|
|
87
|
+
elif suffix == '.csv':
|
|
88
|
+
df = pd.read_csv(file_path)
|
|
89
|
+
|
|
90
|
+
elif suffix == '.parquet':
|
|
91
|
+
df = pd.read_parquet(file_path)
|
|
92
|
+
|
|
93
|
+
else:
|
|
94
|
+
raise ValueError(f"Unsupported format: {suffix}")
|
|
95
|
+
|
|
96
|
+
return df
|
|
97
|
+
|
|
98
|
+
# Load and inspect
|
|
99
|
+
df = load_source_file(Path("data/input.xlsx"))
|
|
100
|
+
print(f"\nShape: {df.shape}")
|
|
101
|
+
print(f"\nColumns:\n{df.dtypes}")
|
|
102
|
+
print(f"\nSample:\n{df.head()}")
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
3. **Infer schema**
|
|
106
|
+
```python
|
|
107
|
+
def infer_sql_types(df: pd.DataFrame) -> dict:
|
|
108
|
+
"""Map pandas dtypes to SQL types (database-agnostic)."""
|
|
109
|
+
type_mapping = {
|
|
110
|
+
'int64': 'INTEGER',
|
|
111
|
+
'float64': 'FLOAT',
|
|
112
|
+
'object': 'VARCHAR(255)',
|
|
113
|
+
'bool': 'BOOLEAN',
|
|
114
|
+
'datetime64[ns]': 'TIMESTAMP',
|
|
115
|
+
'date': 'DATE',
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
schema = {}
|
|
119
|
+
for col in df.columns:
|
|
120
|
+
dtype = str(df[col].dtype)
|
|
121
|
+
sql_type = type_mapping.get(dtype, 'TEXT')
|
|
122
|
+
|
|
123
|
+
# Refine VARCHAR length based on data
|
|
124
|
+
if dtype == 'object':
|
|
125
|
+
max_len = df[col].astype(str).str.len().max()
|
|
126
|
+
if max_len > 255:
|
|
127
|
+
sql_type = 'TEXT'
|
|
128
|
+
else:
|
|
129
|
+
sql_type = f'VARCHAR({min(max_len * 2, 255)})'
|
|
130
|
+
|
|
131
|
+
schema[col] = sql_type
|
|
132
|
+
|
|
133
|
+
return schema
|
|
134
|
+
|
|
135
|
+
schema = infer_sql_types(df)
|
|
136
|
+
print("\nInferred Schema:")
|
|
137
|
+
for col, sql_type in schema.items():
|
|
138
|
+
print(f" {col}: {sql_type}")
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Output
|
|
142
|
+
|
|
143
|
+
```markdown
|
|
144
|
+
## Source Discovery Report
|
|
145
|
+
|
|
146
|
+
### Files Found
|
|
147
|
+
| File | Format | Size | Records | Columns |
|
|
148
|
+
|------|--------|------|---------|---------|
|
|
149
|
+
| [filename] | [format] | [size] | [count] | [count] |
|
|
150
|
+
|
|
151
|
+
### Schema Inference
|
|
152
|
+
| Column | Source Type | SQL Type | Nullable | Sample Values |
|
|
153
|
+
|--------|-------------|----------|----------|---------------|
|
|
154
|
+
| [col] | [pandas dtype] | [SQL type] | [Yes/No] | [examples] |
|
|
155
|
+
|
|
156
|
+
### Data Quality Notes
|
|
157
|
+
- Missing values: [summary]
|
|
158
|
+
- Duplicates: [count]
|
|
159
|
+
- Date formats: [detected format]
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Phase 2: Target Configuration
|
|
165
|
+
|
|
166
|
+
### Objectives
|
|
167
|
+
- Configure database connection
|
|
168
|
+
- Define target table structure
|
|
169
|
+
- Handle existing data (truncate/append/upsert)
|
|
170
|
+
|
|
171
|
+
### Actions
|
|
172
|
+
|
|
173
|
+
1. **Configure database connection (database-agnostic)**
|
|
174
|
+
```python
|
|
175
|
+
from sqlalchemy import create_engine, text
|
|
176
|
+
from urllib.parse import quote_plus
|
|
177
|
+
|
|
178
|
+
def get_db_engine(db_type: str, config: dict):
|
|
179
|
+
"""Create database engine for any supported database."""
|
|
180
|
+
|
|
181
|
+
if db_type == 'sqlserver':
|
|
182
|
+
# SQL Server with Windows Auth
|
|
183
|
+
conn_str = (
|
|
184
|
+
f"DRIVER={{ODBC Driver 17 for SQL Server}};"
|
|
185
|
+
f"SERVER={config['server']};"
|
|
186
|
+
f"DATABASE={config['database']};"
|
|
187
|
+
f"Trusted_Connection=yes;"
|
|
188
|
+
)
|
|
189
|
+
engine = create_engine(
|
|
190
|
+
f"mssql+pyodbc:///?odbc_connect={quote_plus(conn_str)}"
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
elif db_type == 'postgresql':
|
|
194
|
+
engine = create_engine(
|
|
195
|
+
f"postgresql://{config['user']}:{config['password']}"
|
|
196
|
+
f"@{config['host']}:{config.get('port', 5432)}"
|
|
197
|
+
f"/{config['database']}"
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
elif db_type == 'mysql':
|
|
201
|
+
engine = create_engine(
|
|
202
|
+
f"mysql+pymysql://{config['user']}:{config['password']}"
|
|
203
|
+
f"@{config['host']}:{config.get('port', 3306)}"
|
|
204
|
+
f"/{config['database']}"
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
elif db_type == 'sqlite':
|
|
208
|
+
engine = create_engine(f"sqlite:///{config['database']}")
|
|
209
|
+
|
|
210
|
+
else:
|
|
211
|
+
raise ValueError(f"Unsupported database: {db_type}")
|
|
212
|
+
|
|
213
|
+
return engine
|
|
214
|
+
|
|
215
|
+
# Example usage
|
|
216
|
+
engine = get_db_engine('sqlserver', {
|
|
217
|
+
'server': 'localhost',
|
|
218
|
+
'database': 'mydb'
|
|
219
|
+
})
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
2. **Define target table**
|
|
223
|
+
```python
|
|
224
|
+
def create_table_ddl(
|
|
225
|
+
table_name: str,
|
|
226
|
+
schema: dict,
|
|
227
|
+
db_type: str = 'sqlserver',
|
|
228
|
+
primary_key: str = None
|
|
229
|
+
) -> str:
|
|
230
|
+
"""Generate CREATE TABLE DDL for any database."""
|
|
231
|
+
|
|
232
|
+
# Database-specific type adjustments
|
|
233
|
+
type_adjustments = {
|
|
234
|
+
'sqlserver': {
|
|
235
|
+
'TIMESTAMP': 'DATETIME2',
|
|
236
|
+
'TEXT': 'NVARCHAR(MAX)',
|
|
237
|
+
'BOOLEAN': 'BIT'
|
|
238
|
+
},
|
|
239
|
+
'postgresql': {
|
|
240
|
+
'DATETIME2': 'TIMESTAMP',
|
|
241
|
+
'NVARCHAR(MAX)': 'TEXT',
|
|
242
|
+
'BIT': 'BOOLEAN'
|
|
243
|
+
},
|
|
244
|
+
'mysql': {
|
|
245
|
+
'DATETIME2': 'DATETIME',
|
|
246
|
+
'NVARCHAR(MAX)': 'LONGTEXT'
|
|
247
|
+
},
|
|
248
|
+
'sqlite': {
|
|
249
|
+
'DATETIME2': 'TEXT',
|
|
250
|
+
'NVARCHAR(MAX)': 'TEXT'
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
adjustments = type_adjustments.get(db_type, {})
|
|
255
|
+
|
|
256
|
+
columns = []
|
|
257
|
+
for col, sql_type in schema.items():
|
|
258
|
+
adjusted_type = adjustments.get(sql_type, sql_type)
|
|
259
|
+
pk = ' PRIMARY KEY' if col == primary_key else ''
|
|
260
|
+
columns.append(f" {col} {adjusted_type}{pk}")
|
|
261
|
+
|
|
262
|
+
# Add audit columns
|
|
263
|
+
if db_type == 'sqlserver':
|
|
264
|
+
columns.append(" _loaded_at DATETIME2 DEFAULT GETDATE()")
|
|
265
|
+
elif db_type == 'postgresql':
|
|
266
|
+
columns.append(" _loaded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
|
|
267
|
+
elif db_type == 'mysql':
|
|
268
|
+
columns.append(" _loaded_at DATETIME DEFAULT CURRENT_TIMESTAMP")
|
|
269
|
+
else:
|
|
270
|
+
columns.append(" _loaded_at TEXT")
|
|
271
|
+
|
|
272
|
+
ddl = f"CREATE TABLE {table_name} (\n"
|
|
273
|
+
ddl += ",\n".join(columns)
|
|
274
|
+
ddl += "\n);"
|
|
275
|
+
|
|
276
|
+
return ddl
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
3. **Handle existing data**
|
|
280
|
+
```python
|
|
281
|
+
def prepare_target_table(
|
|
282
|
+
engine,
|
|
283
|
+
table_name: str,
|
|
284
|
+
schema: dict,
|
|
285
|
+
mode: str = 'replace', # 'replace', 'append', 'fail'
|
|
286
|
+
db_type: str = 'sqlserver'
|
|
287
|
+
):
|
|
288
|
+
"""Prepare target table for data loading."""
|
|
289
|
+
|
|
290
|
+
with engine.connect() as conn:
|
|
291
|
+
# Check if table exists
|
|
292
|
+
if db_type == 'sqlserver':
|
|
293
|
+
exists_query = text(f"""
|
|
294
|
+
SELECT 1 FROM INFORMATION_SCHEMA.TABLES
|
|
295
|
+
WHERE TABLE_NAME = '{table_name}'
|
|
296
|
+
""")
|
|
297
|
+
elif db_type in ['postgresql', 'mysql']:
|
|
298
|
+
exists_query = text(f"""
|
|
299
|
+
SELECT 1 FROM information_schema.tables
|
|
300
|
+
WHERE table_name = '{table_name}'
|
|
301
|
+
""")
|
|
302
|
+
else:
|
|
303
|
+
exists_query = text(f"""
|
|
304
|
+
SELECT 1 FROM sqlite_master
|
|
305
|
+
WHERE type='table' AND name='{table_name}'
|
|
306
|
+
""")
|
|
307
|
+
|
|
308
|
+
exists = conn.execute(exists_query).fetchone() is not None
|
|
309
|
+
|
|
310
|
+
if exists:
|
|
311
|
+
if mode == 'replace':
|
|
312
|
+
conn.execute(text(f"DROP TABLE {table_name}"))
|
|
313
|
+
conn.commit()
|
|
314
|
+
print(f"Dropped existing table: {table_name}")
|
|
315
|
+
elif mode == 'fail':
|
|
316
|
+
raise ValueError(f"Table {table_name} already exists")
|
|
317
|
+
elif mode == 'append':
|
|
318
|
+
print(f"Will append to existing table: {table_name}")
|
|
319
|
+
return # Don't create, just append
|
|
320
|
+
|
|
321
|
+
# Create new table
|
|
322
|
+
ddl = create_table_ddl(table_name, schema, db_type)
|
|
323
|
+
conn.execute(text(ddl))
|
|
324
|
+
conn.commit()
|
|
325
|
+
print(f"Created table: {table_name}")
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Phase 3: Data Transformation
|
|
331
|
+
|
|
332
|
+
### Objectives
|
|
333
|
+
- Clean and validate data
|
|
334
|
+
- Apply transformations
|
|
335
|
+
- Handle data type conversions
|
|
336
|
+
|
|
337
|
+
### Actions
|
|
338
|
+
|
|
339
|
+
1. **Clean column names**
|
|
340
|
+
```python
|
|
341
|
+
import re
|
|
342
|
+
|
|
343
|
+
def clean_column_names(df: pd.DataFrame) -> pd.DataFrame:
|
|
344
|
+
"""Standardize column names for database compatibility."""
|
|
345
|
+
df = df.copy()
|
|
346
|
+
|
|
347
|
+
new_columns = {}
|
|
348
|
+
for col in df.columns:
|
|
349
|
+
# Convert to lowercase, replace spaces/special chars
|
|
350
|
+
clean = re.sub(r'[^\w]', '_', str(col).lower())
|
|
351
|
+
clean = re.sub(r'_+', '_', clean).strip('_')
|
|
352
|
+
new_columns[col] = clean
|
|
353
|
+
|
|
354
|
+
df.rename(columns=new_columns, inplace=True)
|
|
355
|
+
return df
|
|
356
|
+
|
|
357
|
+
df = clean_column_names(df)
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
2. **Handle data quality issues**
|
|
361
|
+
```python
|
|
362
|
+
def clean_data(df: pd.DataFrame, config: dict = None) -> pd.DataFrame:
|
|
363
|
+
"""Clean data for database loading."""
|
|
364
|
+
df = df.copy()
|
|
365
|
+
config = config or {}
|
|
366
|
+
|
|
367
|
+
# Remove completely empty rows
|
|
368
|
+
df.dropna(how='all', inplace=True)
|
|
369
|
+
|
|
370
|
+
# Handle duplicates
|
|
371
|
+
if config.get('remove_duplicates', False):
|
|
372
|
+
df.drop_duplicates(inplace=True)
|
|
373
|
+
|
|
374
|
+
# Trim string columns
|
|
375
|
+
for col in df.select_dtypes(include=['object']).columns:
|
|
376
|
+
df[col] = df[col].astype(str).str.strip()
|
|
377
|
+
df[col] = df[col].replace(['nan', 'None', ''], None)
|
|
378
|
+
|
|
379
|
+
# Convert date columns
|
|
380
|
+
date_columns = config.get('date_columns', [])
|
|
381
|
+
for col in date_columns:
|
|
382
|
+
if col in df.columns:
|
|
383
|
+
df[col] = pd.to_datetime(df[col], errors='coerce')
|
|
384
|
+
|
|
385
|
+
# Fill nulls for required columns
|
|
386
|
+
required_columns = config.get('required_columns', {})
|
|
387
|
+
for col, default in required_columns.items():
|
|
388
|
+
if col in df.columns:
|
|
389
|
+
df[col].fillna(default, inplace=True)
|
|
390
|
+
|
|
391
|
+
return df
|
|
392
|
+
|
|
393
|
+
# Example
|
|
394
|
+
df = clean_data(df, {
|
|
395
|
+
'remove_duplicates': True,
|
|
396
|
+
'date_columns': ['created_date', 'modified_date'],
|
|
397
|
+
'required_columns': {'status': 'unknown'}
|
|
398
|
+
})
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
3. **Validate data**
|
|
402
|
+
```python
|
|
403
|
+
def validate_data(df: pd.DataFrame, rules: dict) -> tuple[pd.DataFrame, pd.DataFrame]:
|
|
404
|
+
"""Validate data and separate valid/invalid records."""
|
|
405
|
+
|
|
406
|
+
errors = []
|
|
407
|
+
|
|
408
|
+
for idx, row in df.iterrows():
|
|
409
|
+
row_errors = []
|
|
410
|
+
|
|
411
|
+
# Required fields
|
|
412
|
+
for col in rules.get('required', []):
|
|
413
|
+
if pd.isna(row.get(col)) or row.get(col) == '':
|
|
414
|
+
row_errors.append(f"Missing required field: {col}")
|
|
415
|
+
|
|
416
|
+
# Numeric ranges
|
|
417
|
+
for col, (min_val, max_val) in rules.get('ranges', {}).items():
|
|
418
|
+
val = row.get(col)
|
|
419
|
+
if pd.notna(val) and not (min_val <= val <= max_val):
|
|
420
|
+
row_errors.append(f"{col} out of range: {val}")
|
|
421
|
+
|
|
422
|
+
# Pattern matching
|
|
423
|
+
for col, pattern in rules.get('patterns', {}).items():
|
|
424
|
+
val = str(row.get(col, ''))
|
|
425
|
+
if val and not re.match(pattern, val):
|
|
426
|
+
row_errors.append(f"{col} invalid format: {val}")
|
|
427
|
+
|
|
428
|
+
if row_errors:
|
|
429
|
+
errors.append({'index': idx, 'errors': row_errors})
|
|
430
|
+
|
|
431
|
+
# Separate valid and invalid
|
|
432
|
+
invalid_indices = [e['index'] for e in errors]
|
|
433
|
+
valid_df = df[~df.index.isin(invalid_indices)]
|
|
434
|
+
invalid_df = df[df.index.isin(invalid_indices)]
|
|
435
|
+
|
|
436
|
+
print(f"Valid records: {len(valid_df)}")
|
|
437
|
+
print(f"Invalid records: {len(invalid_df)}")
|
|
438
|
+
|
|
439
|
+
return valid_df, invalid_df
|
|
440
|
+
|
|
441
|
+
# Example
|
|
442
|
+
valid_df, invalid_df = validate_data(df, {
|
|
443
|
+
'required': ['customer_id', 'amount'],
|
|
444
|
+
'ranges': {'amount': (0, 1000000)},
|
|
445
|
+
'patterns': {'email': r'^[\w\.-]+@[\w\.-]+\.\w+$'}
|
|
446
|
+
})
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## Phase 4: Load Data
|
|
452
|
+
|
|
453
|
+
### Objectives
|
|
454
|
+
- Load data into target table
|
|
455
|
+
- Handle batch processing for large files
|
|
456
|
+
- Track load statistics
|
|
457
|
+
|
|
458
|
+
### Actions
|
|
459
|
+
|
|
460
|
+
1. **Load data with pandas**
|
|
461
|
+
```python
|
|
462
|
+
from datetime import datetime
|
|
463
|
+
|
|
464
|
+
def load_data(
|
|
465
|
+
df: pd.DataFrame,
|
|
466
|
+
engine,
|
|
467
|
+
table_name: str,
|
|
468
|
+
batch_size: int = 1000,
|
|
469
|
+
if_exists: str = 'append'
|
|
470
|
+
) -> dict:
|
|
471
|
+
"""Load DataFrame to database table."""
|
|
472
|
+
|
|
473
|
+
start_time = datetime.now()
|
|
474
|
+
total_rows = len(df)
|
|
475
|
+
|
|
476
|
+
# Add load timestamp
|
|
477
|
+
df['_loaded_at'] = datetime.now()
|
|
478
|
+
|
|
479
|
+
# Load in batches for large datasets
|
|
480
|
+
if total_rows > batch_size:
|
|
481
|
+
loaded = 0
|
|
482
|
+
for i in range(0, total_rows, batch_size):
|
|
483
|
+
batch = df.iloc[i:i + batch_size]
|
|
484
|
+
batch.to_sql(
|
|
485
|
+
table_name,
|
|
486
|
+
engine,
|
|
487
|
+
if_exists='append' if i > 0 else if_exists,
|
|
488
|
+
index=False,
|
|
489
|
+
method='multi' # Faster bulk insert
|
|
490
|
+
)
|
|
491
|
+
loaded += len(batch)
|
|
492
|
+
print(f"Loaded {loaded}/{total_rows} rows...")
|
|
493
|
+
else:
|
|
494
|
+
df.to_sql(
|
|
495
|
+
table_name,
|
|
496
|
+
engine,
|
|
497
|
+
if_exists=if_exists,
|
|
498
|
+
index=False
|
|
499
|
+
)
|
|
500
|
+
|
|
501
|
+
elapsed = (datetime.now() - start_time).total_seconds()
|
|
502
|
+
|
|
503
|
+
return {
|
|
504
|
+
'table': table_name,
|
|
505
|
+
'rows_loaded': total_rows,
|
|
506
|
+
'elapsed_seconds': elapsed,
|
|
507
|
+
'rows_per_second': total_rows / elapsed if elapsed > 0 else 0
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
# Execute load
|
|
511
|
+
stats = load_data(valid_df, engine, 'staging.customer_data')
|
|
512
|
+
print(f"\nLoad complete: {stats}")
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
2. **Handle errors and logging**
|
|
516
|
+
```python
|
|
517
|
+
from loguru import logger
|
|
518
|
+
|
|
519
|
+
def load_with_error_handling(
|
|
520
|
+
df: pd.DataFrame,
|
|
521
|
+
engine,
|
|
522
|
+
table_name: str,
|
|
523
|
+
error_table: str = None
|
|
524
|
+
) -> dict:
|
|
525
|
+
"""Load data with comprehensive error handling."""
|
|
526
|
+
|
|
527
|
+
stats = {
|
|
528
|
+
'attempted': len(df),
|
|
529
|
+
'loaded': 0,
|
|
530
|
+
'failed': 0,
|
|
531
|
+
'errors': []
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
try:
|
|
535
|
+
result = load_data(df, engine, table_name)
|
|
536
|
+
stats['loaded'] = result['rows_loaded']
|
|
537
|
+
logger.info(f"Successfully loaded {stats['loaded']} rows to {table_name}")
|
|
538
|
+
|
|
539
|
+
except Exception as e:
|
|
540
|
+
logger.error(f"Bulk load failed: {e}")
|
|
541
|
+
|
|
542
|
+
# Fall back to row-by-row loading
|
|
543
|
+
logger.info("Attempting row-by-row loading...")
|
|
544
|
+
|
|
545
|
+
for idx, row in df.iterrows():
|
|
546
|
+
try:
|
|
547
|
+
pd.DataFrame([row]).to_sql(
|
|
548
|
+
table_name, engine, if_exists='append', index=False
|
|
549
|
+
)
|
|
550
|
+
stats['loaded'] += 1
|
|
551
|
+
except Exception as row_error:
|
|
552
|
+
stats['failed'] += 1
|
|
553
|
+
stats['errors'].append({
|
|
554
|
+
'index': idx,
|
|
555
|
+
'error': str(row_error)
|
|
556
|
+
})
|
|
557
|
+
|
|
558
|
+
# Save failed rows to error table
|
|
559
|
+
if error_table and stats['failed'] > 0:
|
|
560
|
+
failed_indices = [e['index'] for e in stats['errors']]
|
|
561
|
+
failed_df = df.loc[failed_indices]
|
|
562
|
+
failed_df['_error'] = [
|
|
563
|
+
e['error'] for e in stats['errors']
|
|
564
|
+
]
|
|
565
|
+
failed_df.to_sql(
|
|
566
|
+
error_table, engine, if_exists='append', index=False
|
|
567
|
+
)
|
|
568
|
+
logger.info(f"Saved {stats['failed']} failed rows to {error_table}")
|
|
569
|
+
|
|
570
|
+
return stats
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
---
|
|
574
|
+
|
|
575
|
+
## Phase 5: Verification
|
|
576
|
+
|
|
577
|
+
### Objectives
|
|
578
|
+
- Verify data loaded correctly
|
|
579
|
+
- Generate load report
|
|
580
|
+
- Clean up staging data if needed
|
|
581
|
+
|
|
582
|
+
### Actions
|
|
583
|
+
|
|
584
|
+
1. **Verify load**
|
|
585
|
+
```python
|
|
586
|
+
def verify_load(engine, table_name: str, expected_count: int) -> dict:
|
|
587
|
+
"""Verify data was loaded correctly."""
|
|
588
|
+
|
|
589
|
+
with engine.connect() as conn:
|
|
590
|
+
# Row count
|
|
591
|
+
result = conn.execute(text(f"SELECT COUNT(*) FROM {table_name}"))
|
|
592
|
+
actual_count = result.scalar()
|
|
593
|
+
|
|
594
|
+
# Sample data
|
|
595
|
+
result = conn.execute(text(f"SELECT * FROM {table_name} LIMIT 5"))
|
|
596
|
+
sample = result.fetchall()
|
|
597
|
+
|
|
598
|
+
verification = {
|
|
599
|
+
'expected': expected_count,
|
|
600
|
+
'actual': actual_count,
|
|
601
|
+
'match': expected_count == actual_count,
|
|
602
|
+
'sample_rows': len(sample)
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
if verification['match']:
|
|
606
|
+
print(f"✅ Verification passed: {actual_count} rows loaded")
|
|
607
|
+
else:
|
|
608
|
+
print(f"❌ Verification failed: expected {expected_count}, got {actual_count}")
|
|
609
|
+
|
|
610
|
+
return verification
|
|
611
|
+
|
|
612
|
+
verify_load(engine, 'staging.customer_data', len(valid_df))
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
2. **Generate load report**
|
|
616
|
+
```python
|
|
617
|
+
def generate_load_report(
|
|
618
|
+
source_file: str,
|
|
619
|
+
target_table: str,
|
|
620
|
+
stats: dict,
|
|
621
|
+
verification: dict
|
|
622
|
+
) -> str:
|
|
623
|
+
"""Generate markdown load report."""
|
|
624
|
+
|
|
625
|
+
report = f"""
|
|
626
|
+
## Data Load Report
|
|
627
|
+
|
|
628
|
+
### Summary
|
|
629
|
+
| Metric | Value |
|
|
630
|
+
|--------|-------|
|
|
631
|
+
| Source File | `{source_file}` |
|
|
632
|
+
| Target Table | `{target_table}` |
|
|
633
|
+
| Load Time | {stats.get('elapsed_seconds', 0):.2f}s |
|
|
634
|
+
| Status | {'✅ Success' if verification['match'] else '❌ Failed'} |
|
|
635
|
+
|
|
636
|
+
### Row Counts
|
|
637
|
+
| Stage | Count |
|
|
638
|
+
|-------|-------|
|
|
639
|
+
| Source Records | {stats.get('attempted', 0)} |
|
|
640
|
+
| Loaded | {stats.get('loaded', 0)} |
|
|
641
|
+
| Failed | {stats.get('failed', 0)} |
|
|
642
|
+
| Verified in DB | {verification.get('actual', 0)} |
|
|
643
|
+
|
|
644
|
+
### Performance
|
|
645
|
+
- **Throughput**: {stats.get('rows_per_second', 0):.0f} rows/second
|
|
646
|
+
|
|
647
|
+
### Errors
|
|
648
|
+
{f"- {len(stats.get('errors', []))} errors logged" if stats.get('errors') else "- No errors"}
|
|
649
|
+
"""
|
|
650
|
+
return report
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
---
|
|
654
|
+
|
|
655
|
+
## Complete Example
|
|
656
|
+
|
|
657
|
+
```python
|
|
658
|
+
"""Complete data loading pipeline - database agnostic."""
|
|
659
|
+
|
|
660
|
+
from pathlib import Path
|
|
661
|
+
import pandas as pd
|
|
662
|
+
from sqlalchemy import create_engine, text
|
|
663
|
+
from loguru import logger
|
|
664
|
+
|
|
665
|
+
# Configuration
|
|
666
|
+
CONFIG = {
|
|
667
|
+
'source_file': 'data/customers.xlsx',
|
|
668
|
+
'target_table': 'staging.customers',
|
|
669
|
+
'db_type': 'sqlserver', # or 'postgresql', 'mysql', 'sqlite'
|
|
670
|
+
'db_config': {
|
|
671
|
+
'server': 'localhost',
|
|
672
|
+
'database': 'mydb'
|
|
673
|
+
},
|
|
674
|
+
'load_mode': 'replace', # 'replace', 'append', 'fail'
|
|
675
|
+
'validation_rules': {
|
|
676
|
+
'required': ['customer_id', 'name'],
|
|
677
|
+
'date_columns': ['created_date']
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
def main():
|
|
682
|
+
# Phase 1: Source Discovery
|
|
683
|
+
logger.info(f"Loading source: {CONFIG['source_file']}")
|
|
684
|
+
df = load_source_file(Path(CONFIG['source_file']))
|
|
685
|
+
logger.info(f"Found {len(df)} records, {len(df.columns)} columns")
|
|
686
|
+
|
|
687
|
+
# Phase 2: Target Configuration
|
|
688
|
+
engine = get_db_engine(CONFIG['db_type'], CONFIG['db_config'])
|
|
689
|
+
schema = infer_sql_types(df)
|
|
690
|
+
prepare_target_table(
|
|
691
|
+
engine,
|
|
692
|
+
CONFIG['target_table'],
|
|
693
|
+
schema,
|
|
694
|
+
CONFIG['load_mode'],
|
|
695
|
+
CONFIG['db_type']
|
|
696
|
+
)
|
|
697
|
+
|
|
698
|
+
# Phase 3: Transform
|
|
699
|
+
df = clean_column_names(df)
|
|
700
|
+
df = clean_data(df, CONFIG.get('validation_rules', {}))
|
|
701
|
+
valid_df, invalid_df = validate_data(df, CONFIG.get('validation_rules', {}))
|
|
702
|
+
|
|
703
|
+
# Phase 4: Load
|
|
704
|
+
stats = load_with_error_handling(
|
|
705
|
+
valid_df,
|
|
706
|
+
engine,
|
|
707
|
+
CONFIG['target_table'],
|
|
708
|
+
error_table='staging.load_errors'
|
|
709
|
+
)
|
|
710
|
+
|
|
711
|
+
# Phase 5: Verify
|
|
712
|
+
verification = verify_load(engine, CONFIG['target_table'], len(valid_df))
|
|
713
|
+
|
|
714
|
+
# Generate report
|
|
715
|
+
report = generate_load_report(
|
|
716
|
+
CONFIG['source_file'],
|
|
717
|
+
CONFIG['target_table'],
|
|
718
|
+
stats,
|
|
719
|
+
verification
|
|
720
|
+
)
|
|
721
|
+
logger.info(report)
|
|
722
|
+
|
|
723
|
+
return stats
|
|
724
|
+
|
|
725
|
+
if __name__ == '__main__':
|
|
726
|
+
main()
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
---
|
|
730
|
+
|
|
731
|
+
## Dependencies
|
|
732
|
+
|
|
733
|
+
```txt
|
|
734
|
+
# requirements.txt additions for data loading
|
|
735
|
+
pandas>=2.0.0
|
|
736
|
+
openpyxl>=3.1.0 # Excel support
|
|
737
|
+
xlrd>=2.0.0 # Legacy Excel (.xls)
|
|
738
|
+
sqlalchemy>=2.0.0 # Database abstraction
|
|
739
|
+
pyodbc>=4.0.0 # SQL Server
|
|
740
|
+
psycopg2-binary>=2.9.0 # PostgreSQL (optional)
|
|
741
|
+
pymysql>=1.0.0 # MySQL (optional)
|
|
742
|
+
pyarrow>=12.0.0 # Parquet support (optional)
|
|
743
|
+
loguru>=0.7.0 # Logging
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
---
|
|
747
|
+
|
|
748
|
+
## Related Resources
|
|
749
|
+
|
|
750
|
+
- `@sql-expert` - Database design and query optimization
|
|
751
|
+
- `@data-engineer` - ETL pipeline design and orchestration
|
|
752
|
+
- `/data-analysis` - Analyze loaded data
|
|
753
|
+
- `python.instructions.md` - Python coding standards
|