Comments (9)
👍
🤘
from datamasker.
This seems odd. Are you able to share a small sample database with the problem?
from datamasker.
I can send a wetransfer link with the demo database I'm using WeTransfer Demo database
Maybe this can already help:
When I try to debug the source code, the DataMasker.SqlDataProvider.GetValue performs a function DynamicParameters param = new DynamicParameters(obj);
the object param
seems to null:
from datamasker.
It looks like an issue with the SQL querying being generated, due to the spaces in column name. This is what is produced by dapper (even on the latest version)
exec sp_executesql N'SELECT UPPER(Name) FROM [CRONUS International Ltd_$Contact$437dbf0e-84ff-417a-965d-ed2bb9650972] WHERE [No_] = @No_',N'
@No_ nvarchar(4000),@Search Name nvarchar(4000)',
@No_=N'CT100006',
@Search Name=N'A. GIBSON"S LAW FIRM'
However it should be
exec sp_executesql N'SELECT UPPER(Name) FROM [CRONUS International Ltd_$Contact$437dbf0e-84ff-417a-965d-ed2bb9650972] WHERE [No_] = @No_',N'
@No_ nvarchar(4000),@SearchName nvarchar(4000)',
@No_=N'CT100006',
@SearchName=N'A. GIBSON"S LAW FIRM'
Changing "Search Name" to be "SearchName".
I will need to write some integration with dapper to strip spaces and replace them with something that won't clash with other column names.
from datamasker.
@louagej If you have time, then feel free to write a work around, I can accept a PR. If not it may have to wait a until I have time to figure out a good solution
from datamasker.
is this a possible solution?
https://dapper-tutorial.net/knowledge-base/14814972/dapper--map-to-sql-column-with-spaces-in-column-names
from datamasker.
Hi @Steveiwonder ,
This feature request was already a long time on my trying to complete list, but I never got time for it.
Today I spent a couple of hours trying to get this working.
The databases are Microsoft Dynamics 365 designed by Microsoft, so there is no change we can change the column names.
But I think I found a possible workaround for this problem.
I tried to change the code myself, but since I'm not a dotnet developer... :(
But I think I know the place were it could be fixed:
public static string GetUpdateColumns(
this IList<ColumnConfig> columns,
string paramPrefix = null)
{
return string.Join(", ", columns.Where(x => !x.Ignore).Select(x => $"[{x.Name}] = @{paramPrefix}{x.Name}"));
}
Before and after the {paramPrefix}{x.Name}, there should be a double quote added to the string.
So the SQL value return the would be:
"UPDATE [dbo].[CRONUS BELGIË NV$Contact] SET [Search Name] = @"Search Name" WHERE [No_] = @No_"
This way the SQL variables should be able to contain spaces
from datamasker.
Hey @louagej, the issue was with the rows being passed back into the UPDATE
query, and in your case the column name having spaces in them, SQL variable/params cannot contain spaces.
The solution is to replace all spaces inside a parameter with '_', so in your case the update query will look like this when generated
UPDATE [dbo].[CRONUS BELGIË NV$Contact] SET [Search Name] = @Search_Name WHERE [No_] = @No_
The fix is available in
https://www.nuget.org/packages/DataMasker/2.0.57
https://github.com/Steveiwonder/DataMasker/releases/tag/2.0.57
I'll leave this issue open for a few days, can you please let me know if this works for you?
Thanks
Steve
from datamasker.
this is working perfect like this.
I ended up updating a Column that has a space in the name and with an SQL Select statement
Thanks a lot!
from datamasker.
Related Issues (20)
- Breaking application HOT 1
- Does support database integrity HOT 5
- Other DBs? HOT 5
- Create new table instead of replacing HOT 1
- Invalid object name HOT 3
- [Question] How to substitute 300,000 names HOT 1
- json schema isn't in Repo HOT 2
- Allow min/max values per column
- DataMasker runs out of memory when processing large datasets HOT 1
- DataMasker still runs out of memory when processing ultra-large datasets HOT 2
- Net Standard upgrade HOT 5
- Use Select in JSON (Question) HOT 3
- System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime HOT 1
- Sequence contains no matching element HOT 3
- Release assets missing CLI executable HOT 2
- Example using SQL Server HOT 10
- Possible enhancements HOT 3
- Support for Windows Authentication SQL Server HOT 1
- Enforce Uniqueness on columns? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datamasker.