Skip to content

Add --filter option to data schema command #502

@joshsmithxrm

Description

@joshsmithxrm

Problem

No CLI way to add filters during schema generation. Users must manually edit the generated XML and use the awkward HTML-encoded format:

<filter>&lt;filter type="and"&gt;&lt;condition attribute="country" operator="eq" value="US"/&gt;&lt;/filter&gt;</filter>

Proposed Solution

Add --filter option using SQL-like syntax (matches existing update/delete commands):

ppds data schema -e account,contact -o schema.xml \
  --filter "account:statecode eq 0" \
  --filter "contact:createdon gt 2024-01-01"

The filter expression uses the same syntax as ppds data update --filter and ppds data delete --filter, leveraging the existing SqlToFetchXmlTranspiler.

Implementation

File Change
src/PPDS.Cli/Commands/Data/SchemaCommand.cs Add --filter option (repeatable, format: entity:expression)
src/PPDS.Migration/Schema/SchemaGeneratorOptions.cs Add EntityFilters dictionary property
src/PPDS.Migration/Schema/DataverseSchemaGenerator.cs Apply filters to generated EntitySchema objects
tests/PPDS.LiveTests/Cli/DataSchemaCommandE2ETests.cs Add filter tests

Validation

  • Error if --filter "foo:..." but foo not in --entities list
  • Validate filter syntax before writing schema

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions