Casting issue for output configuration

Open
#141 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
ruby, sql
Domain
backend, databases

Research direction

Start by reproducing the SQL Server destination case described in the output configuration, using a uniqueidentifier first column and the logged INSERT statement. Trace where the output builds the INSERT and adds SELECT CAST(SCOPE_IDENTITY() AS bigint) AS Ident, then verify that the identifier is preserved without an incompatible cast and add coverage for this case if the repository has matching tests.

Written by the indexing model from the issue text.

Description

bug needs-investigation

I'm having an issue pushing data into SQL Server using this plugin. It seems the only issue I'm having is the first column, which is configured as a unique identifier in both my source and destination databases, is being cast to an int or bigint when trying to ingest. I've checked my data being pulled from my source plugin and it is correct, it seems as though this plugin has some casting issue when using output configuration.

{"time":"2023-10-24T21:28:29","level":"warn","message":"Got deterministic error. Fallback to one-by-one import error_class_ActiveRecord::StatementInvalid error="TinyTds::Error: Conversion failed when converting from a character string to uniqueidentifier.:INSERT INTO [table1] ([id],[status],[ident]) VALUES ('1',N'Status1',1); SELECT CAST(SCOPE_IDENTITY() AS bigint) AS Ident"","work_id:0}

If anyone has seen or knows a workaround for this that would be greatly appreciated.

Dominant language
Ruby
Stars
112
Forks
58
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fluent/fluent-plugin-sql

All issues in fluent/fluent-plugin-sql

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.