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

[bug-fix] generate separated SQL statements #483

Merged
merged 3 commits into from
Oct 24, 2022

Conversation

NarekDW
Copy link
Contributor

@NarekDW NarekDW commented Oct 24, 2022

Fix the bug with generation of separated SQL statements.

For example, such code:

BaseFaker faker = new BaseFaker(new Random(10L));
        Schema<Object, ?> schema = Schema.of(
            field("Text", () -> faker.name().firstName()),
            field("Bool", () -> faker.bool().bool())
        );

        SqlTransformer<Object> transformer = new SqlTransformer.SqlTransformerBuilder<>().build();
        String sql = transformer.generate(schema, 2);

Computes such a result:
INSERT INTO "MyTable" ("Text", "Bool") VALUES ('Willis', false)INSERT INTO "MyTable" ("Text", "Bool") VALUES ('Carlena', true);

But I'm expecting to get:
INSERT INTO "MyTable" ("Text", "Bool") VALUES ('Willis', false);
INSERT INTO "MyTable" ("Text", "Bool") VALUES ('Carlena', true);

Also, added some little improvement in API of Transformer interface

@bodiam
Copy link
Contributor

bodiam commented Oct 24, 2022

Seems there's a new flaky test in the phone number generators. I'll have a look. I retriggered the build

@codecov-commenter
Copy link

codecov-commenter commented Oct 24, 2022

Codecov Report

Merging #483 (d52ed46) into main (ed7c209) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main     #483      +/-   ##
============================================
+ Coverage     93.02%   93.03%   +0.01%     
- Complexity     2140     2146       +6     
============================================
  Files           233      234       +1     
  Lines          4473     4481       +8     
  Branches        467      466       -1     
============================================
+ Hits           4161     4169       +8     
- Misses          196      197       +1     
+ Partials        116      115       -1     
Impacted Files Coverage Δ
...net/datafaker/transformations/JsonTransformer.java 84.37% <ø> (ø)
.../net/datafaker/transformations/CsvTransformer.java 96.42% <100.00%> (+3.32%) ⬆️
.../net/datafaker/transformations/SqlTransformer.java 81.02% <100.00%> (-1.15%) ⬇️
...ava/net/datafaker/transformations/Transformer.java 100.00% <100.00%> (ø)
...ker/idnumbers/pt/br/IdNumberGeneratorPtBrUtil.java 92.59% <0.00%> (-3.71%) ⬇️
...java/net/datafaker/transformations/SqlDialect.java 92.30% <0.00%> (+4.61%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@bodiam
Copy link
Contributor

bodiam commented Oct 24, 2022

@NarekDW nice one, thank you!

@bodiam bodiam merged commit ec58a2e into datafaker-net:main Oct 24, 2022
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