End-to-end SQL support: schema discovery, DataFrame bridge, helpers, guardrails by Copilot · Pull Request #141 · microsoft/PowerPlatform-DataverseClient-Python · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
5b08ea0
Initial plan
Copilot Mar 13, 2026
d61ffca
Add list_columns, list_relationships, list_table_relationships APIs w…
Copilot Mar 13, 2026
7f06533
End-to-end SQL support: schema discovery, SELECT * expansion, DataFra…
Mar 21, 2026
12d3e86
Adjust guardrails: remove TOP injection (server enforces 5000 cap), a…
Mar 21, 2026
89adad3
Add SQL helper functions: sql_columns, sql_select, sql_joins, sql_join
Mar 21, 2026
86f9c37
Add OData helpers: odata_select, odata_expands, odata_expand, odata_bind
Mar 21, 2026
76525ff
Fix: add ManyToOneRelationships to list_table_relationships
Mar 22, 2026
769616b
Fix: exclude computed display-name columns from sql_columns/odata_select
Mar 22, 2026
e251f42
Fix: move write guardrail before table extraction + test 8-table JOIN…
Mar 22, 2026
3945b8b
Update sql_examples.py: add AND/OR, NOT IN, deep JOINs, helpers, SQL …
Mar 22, 2026
50cf7d7
Proven: 15-table SQL JOINs work (no depth limit, unlike OData's 10-le…
Mar 22, 2026
f8f5151
Add anti-pattern warnings + best practices section to sql_examples.py
Mar 22, 2026
7096624
Upgrade: cross join guardrail from warning to ValidationError
Mar 22, 2026
68d32ea
Revert: cross join guardrail back to UserWarning (not ValidationError)
Mar 22, 2026
a09e266
Block all server-rejected SQL patterns in SDK (save round-trip)
Mar 22, 2026
b18a219
Improve anti-pattern #4: mention sql_select() helper, clarify SELECT …
Mar 22, 2026
a595a72
Address all 11 PR review comments
Mar 22, 2026
a0ae21d
Fix README: list_table_relationships includes ManyToOne (confirmed Da…
Mar 22, 2026
b5eb12b
Full audit: fix Learn docstrings, add __all__, fix param doc, add Att…
Mar 22, 2026
56f19b8
Fix CodeQL ReDoS: replace vulnerable write regex with comment-strippi…
Mar 22, 2026
e129eed
fix: address 5 Copilot review comments (round 2)
Mar 22, 2026
2f22009
Merge main into copilot/add-public-api-for-metadata
Apr 9, 2026
aa896b8
fix: update SQL parameter extraction to use URL parsing in query SQL …
Apr 9, 2026
f4afbef
fix: integration tests for SQL examples
Apr 9, 2026
2e66233
fix: auto-lowercase table names in _build_lookup_field_models, remove…
Copilot Apr 9, 2026
5942c4a
Merge branch 'main' into copilot/add-public-api-for-metadata
sagebree Apr 13, 2026
f499a30
Block SELECT * queries with ValidationError — intentional design deci…
Apr 22, 2026
f96e1a1
Refactor SQL query handling and error management in Dataverse SDK
Apr 23, 2026
e916082
Fix black formatting
Apr 23, 2026
2e98496
Add distinct alias generation for SQL joins to prevent collisions
Apr 23, 2026
fb9a569
Merge branch 'main' into copilot/add-public-api-for-metadata
sagebree Apr 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 80 additions & 4 deletions README.md
16 changes: 16 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ Deep-dive into production-ready patterns and specialized functionality:
- Column metadata management and multi-language support
- Interactive cleanup and best practices

- **`sql_examples.py`** - **SQL QUERY END-TO-END** 🔍
- Schema discovery before writing SQL (list_columns, list_relationships)
- Full SQL capabilities: SELECT, WHERE, TOP, ORDER BY, LIKE, IN, BETWEEN
- JOINs (INNER, LEFT, multi-table), GROUP BY, DISTINCT, aggregates
- OFFSET FETCH for server-side pagination
- Polymorphic lookups via SQL (ownerid, customerid, createdby)
- SQL read -> DataFrame transform -> SDK write-back (full round-trip)
- SQL-driven bulk create, update, and delete patterns
- SQL to DataFrame via `client.dataframe.sql()`
- Limitations with SDK fallbacks (writes, subqueries, functions)
- Complete reference table: SQL vs SDK method mapping

- **`file_upload.py`** - **FILE OPERATIONS** 📎
- File upload to Dataverse file columns with chunking
- Advanced file handling patterns
Expand Down Expand Up @@ -68,13 +80,17 @@ python examples/basic/functional_testing.py
```bash
# Comprehensive walkthrough with production patterns
python examples/advanced/walkthrough.py

# SQL queries end-to-end with SDK fallbacks for unsupported operations
python examples/advanced/sql_examples.py
```

## 🎯 Quick Start Recommendations

- **New to the SDK?** → Start with `examples/basic/installation_example.py`
- **Need to test/validate?** → Use `examples/basic/functional_testing.py`
- **Want to see all features?** → Run `examples/advanced/walkthrough.py`
- **Using SQL queries?** → Run `examples/advanced/sql_examples.py`
- **Building production apps?** → Study patterns in `examples/advanced/walkthrough.py`

## 📋 Prerequisites
Expand Down
38 changes: 19 additions & 19 deletions examples/advanced/relationships.py
Loading
Loading