Skip to content

Allow Bulk Insert for a specified list of columns (#311) - #359

Open
NTmatter wants to merge 1 commit into
prisma:mainfrom
NTmatter:bulk-columns
Open

Allow Bulk Insert for a specified list of columns (#311)#359
NTmatter wants to merge 1 commit into
prisma:mainfrom
NTmatter:bulk-columns

Conversation

@NTmatter

@NTmatter NTmatter commented Oct 1, 2024

Copy link
Copy Markdown

Adds bulk_insert_columns(self, table, columns) and turns bulk_insert(self, table) into a compatibility shim that calls self.bulk_insert_columns(table, &["*"]), maintaining the existing behaviour.

This should simplify bulk inserts in cases where column order may be unpredictable, or only a subset of columns need to be inserted.

Adds `bulk_insert_columns(self, table, columns)` and turns `bulk_insert(self, table)` into
a compatibility shim that calls `self.bulk_insert_columns(table, &["*"])`, maintaining the
existing behaviour.
MattJackson added a commit to MattJackson/tiberius-ng that referenced this pull request Aug 29, 2026
joelparkerhenderson added a commit to mssql-rust/mssql-rust that referenced this pull request Aug 29, 2026
Mirrors prisma/tiberius#359, fixes upstream issue #311.
Client::bulk_insert_columns(table, columns) lets callers restrict and
order the columns used in a BULK INSERT, so source data that doesn't
cover every column or is in a different column order than the table
can still use bulk_insert. bulk_insert(table) becomes a thin wrapper
calling bulk_insert_columns(table, &["*"]).

Ported the test macro to this fork's mssql/pastey naming.

Verified live against a real SQL Server (Azure SQL Edge via rustls):
all 8 new tests pass (default/override column subsets, both orderings,
optional and NOT NULL variants), plus the full 88-test tests/bulk.rs
suite. Also verified: cargo check across all 6 CI feature
combinations, cargo clippy --all-targets, cargo fmt --check, and cargo
test --lib (153 passing).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0156Di1tRRLsJK8ctU1AmAJr
MattJackson added a commit to MattJackson/tiberius-ng that referenced this pull request Aug 29, 2026
…risma#397, prisma#217, prisma#403)

Adapted from upstream prisma#398 (author @etylermoss), reconciled with the
already-integrated bulk_insert_columns (prisma#359):
- Client::column_metadata(table, columns) returns owned Vec<MetaDataColumn>
  (names, types, size/precision/scale, nullability, identity); bulk insert
  now shares this path.
- MetaDataColumn::col_name()/base() accessors; BaseMetaDataColumn::
  is_identity()/is_nullable()/ty()/flags() (resolves prisma#403).
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