Skip to content

Import-DbaCsv, Export-DbaCsv - Normalize table/schema names via Get-ObjectNameParts#10306

Draft
andreasjordan wants to merge 1 commit intodevelopmentfrom
claude/issue-9010-20260403-1523
Draft

Import-DbaCsv, Export-DbaCsv - Normalize table/schema names via Get-ObjectNameParts#10306
andreasjordan wants to merge 1 commit intodevelopmentfrom
claude/issue-9010-20260403-1523

Conversation

@andreasjordan
Copy link
Copy Markdown
Collaborator

@andreasjordan andreasjordan commented Apr 3, 2026

Fixes inconsistency where commands with bracketed table names (e.g. [My.Table]) failed because sys.tables stores bare names without brackets.

  • Import-DbaCsv: normalize $table/$schema with Get-ObjectNameParts before using them in parameterized metadata queries
  • Export-DbaCsv: replace naive dot-split regex with Get-ObjectNameParts

Generated with Claude Code

Edit of andreasjordan:
Fixes part of #9010 - more PRs need to follow. So we keep the issue open but limit this PR to the DbaCsv commands. After this is merged we can find other commands that need the same fix.

IMPORTANT: This is a breaking change so maybe merge later together with other breaking changes and release a new version 2.8.0

…bjectNameParts

Fixes inconsistency where commands with bracketed table names (e.g. [My.Table])
failed because sys.tables stores bare names without brackets.

- Import-DbaCsv: normalize $table/$schema with Get-ObjectNameParts before using
  them in parameterized metadata queries (sys.tables, sys.schemas,
  INFORMATION_SCHEMA.COLUMNS). Also handles two-part schema.table input.
- Export-DbaCsv: replace naive dot-split regex with Get-ObjectNameParts so that
  names like [Gross.Table.Name] are correctly parsed instead of being split on
  the dot inside the brackets.

Closes #9010

(do *Csv*)

Co-authored-by: Andreas Jordan <andreasjordan@users.noreply.github.com>
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