Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing dw query builder to handle Unicode characters #1901

Closed
wants to merge 7 commits into from

Conversation

rohkhann
Copy link
Contributor

@rohkhann rohkhann commented Nov 27, 2023

Why make this change?

Dw pipeline test case was failing due to incorrect parsing for chinese characters.
In addition, dw pipeline was not enabled for linux.

What is this change?

Use the N' prefix that handles unicode characters correctly when building the json in dw.
Added the db type in the config-generator.sh

Tests

Unique characters test case passes along with other test cases.

Copy link
Contributor

@seantleonard seantleonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need more background on changes

src/Core/Resolvers/DWSqlQueryBuilder.cs Show resolved Hide resolved
src/Core/Resolvers/DWSqlQueryBuilder.cs Show resolved Hide resolved
@seantleonard
Copy link
Contributor

and a test to validate

@rohkhann
Copy link
Contributor Author

rohkhann commented Nov 27, 2023

and a test to validate

There is a test already which was failing do to this. that test passes now.

@rohkhann rohkhann closed this Nov 27, 2023
@rohkhann rohkhann reopened this Nov 27, 2023
@abhishekkumams
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@abhishekkumams abhishekkumams self-assigned this Nov 30, 2023
@abhishekkumams abhishekkumams removed their assignment Dec 1, 2023
Copy link
Contributor

@seantleonard seantleonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some changes to get things near passing.

elif [[ $# -eq 1 ]]; then
databaseType=$1;
if ! { [ $databaseType == "mssql" ] || [ $databaseType == "mysql" ] || [ $databaseType == "postgresql" ] || [ $databaseType == "cosmosdb_nosql" ]; }; then
echo "Valid arguments are mssql, mysql, postgresql or cosmosdb_nosql";
if [[ " ${allowedDbTypes[@]} " =~ " ${databaseType} " ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [[ " ${allowedDbTypes[@]} " =~ " ${databaseType} " ]]; then
if [[ ! " ${allowedDbTypes[@]} " =~ " ${databaseType} " ]]; then

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 86 has error:

arguments: '--filter "TestCategory=DwSql" --no-build --configuration $(buildConfiguration) --collect "XPlat Code coverage"'

should be all lowercase dwsql

arguments: '--filter "TestCategory=dwsql" --no-build --configuration $(buildConfiguration) --collect "XPlat Code coverage"'

inputs:
targetType: 'inline'
script: |
password=$(cat /dev/urandom | tr -dc 'A-Za-z0-9_!@#$%^&*()\-+=' | head -c24)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to avoid issues related to needing escape characters for certain sequences, you should remove @ and $
per:
https://learn.microsoft.com/en-us/sql/relational-databases/security/strong-passwords?view=sql-server-ver16#:~:text=Starts%20with%20the%20%24%20or%20%40%20character.

Because logins, user names, roles, and passwords are frequently used in Transact-SQL statements, certain symbols must be enclosed by double quotation marks (") or square brackets ([ ]). Use these delimiters in Transact-SQL statements when the SQL Server login, user, role, or password has the following characteristics:

Contains or starts with a space character.

Starts with the $ or @ character.

seantleonard added a commit that referenced this pull request Dec 1, 2023
…e characters (#1907)

- Fixes errors in `dw-sql` pipeline for Linux OS type
- Original PR with the changes: [#1901
](#1901)

# Description from the mentioned PR

## Why make this change?

Dw pipeline test case was failing due to incorrect parsing for chinese
characters.
In addition, dw pipeline was not enabled for linux. 

## What is this change?

Use the N' prefix that handles unicode characters correctly when
building the json in dw.
Added the db type in the config-generator.sh

## Tests
Unique characters test case passes along with other test cases.

Co-Author: @rohkhann

---------

Co-authored-by: Rohan Khanna <rohkhann@microsoft.com>
Co-authored-by: rohkhann <124841904+rohkhann@users.noreply.github.com>
Co-authored-by: Sean Leonard <sean.leonard@microsoft.com>
@seantleonard
Copy link
Contributor

closing as this was merged with different branch. Co-author tag added to ensure you're credited for this work.

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.

4 participants