The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I am attempting to run a stored procedure in a Fabric Data Factory Pipeline. The stored procedure is hosted on a Fabric Database.
Here are the settings:
The connection test successfully runs. When I run the stored procedure via SSMS it runs successfully also.
But when I run within Data Factory, I get this error: "An item with the same key has already been added."
What could cause this? There are no key violations in the table the data is inserting into, and there are no duplicate columns.
I even created a fresh table and pointed the stored procedure to it, and ran with a new stored procedure activity, and I received the same error.
Hi @turner_kunkel
Here are some quick steps you can try to resolve it:
1.Check Parameter Names: Ensure all pipeline and stored procedure parameters have unique names.
2.Verify Mapping: Ensure no duplicate keys in pipeline parameter mapping.
3.Connection Settings: Double-check connection settings match SSMS.
4.Stored Procedure Logic: Ensure no duplicate keys are being inserted in the procedure.
5.Recreate Activity: Recreate the pipeline activity to rule out configuration bugs.
6.Debug Logs: Use debug logs to identify detailed issues.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I'm experiencing a similar issue as the OP but when using a Script activity on a Fabric SQL DB. The script is very simple and is not peforming any inserts:
TRUNCATE TABLE dbo.TableName
Hi @turner_kunkel ,
The error("An item with the same key has already been added.") indicates that stored procedure is trying to add a record with same key which exists already. Are you using Fabric SQL DB ? Is your table is having Identity columns ?
Regards,
Srisakthi
As stated in the original post, I attempted this same operation on a new, empty table and experienced the same behavior - again pointing to some issue in Fabric with these activities.
I do have identity set up on the table (and yes it is in Fabric Database). If I plug in the parameters passed in a SQL query directly the procedure runs without issue. This leads me to believe this error message is a misnomer provided by Fabric somehow.
Hi @turner_kunkel,
For an error like “An item with the same key has already been added”. This usually happens when you try to add a duplicate key (such as a or a) to a collection.
According to your description, other scenarios are normal, but the error occurs in data factory, which may be caused by the auto-detection feature of data factory. In some cases, the auto-detect feature may cause this error. You can try to disable these features as follows:
1.Open Fabric Data Factory.
2.Go to Settings Options.
3.Turn off the “Import relationships from data source on first load” option.
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Where would this setting be in Fabric Data Factory? I cannot find it within the Fabric workspace portal when I open the Data Factory splash page or the pipeline I've already created.
Also, I'm confused regarding this solution. I'm not loading any data from this activity. It is running a stored procedure.
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |
User | Count |
---|---|
4 | |
3 | |
2 | |
2 | |
2 |