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
feat(mariadb): implementation for MariaDB #10192
Conversation
This differ from MySQL mostly for 3 things: - driver is different (mariadb) - use of schema - MariaDB JSON implementation differ from MySQL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bunch of nits, looks good over all.
Codecov Report
@@ Coverage Diff @@
## master #10192 +/- ##
==========================================
- Coverage 96.34% 96.28% -0.07%
==========================================
Files 63 68 +5
Lines 9420 9796 +376
==========================================
+ Hits 9076 9432 +356
- Misses 344 364 +20
Continue to review full report at Codecov.
|
Correcting padding, simplify implementation according to remarks Use Set when possible, benchmarks showing better performance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better now, some minor nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments for now
This looks almost ready @rusher , Please extend documentation so it references
I'll do some testing locally in the evening, we can hopefully merge this tomorrow |
@sushantdhiman Just tell me if you think anything else is missing. I don't see any other improvement that i can do, but better bulk implementation (mariadb connector has a dedicated bath API that use a MariaDB specific protocol, but that would be another PR) |
changing travis docker
let startWithDot = true; | ||
|
||
// Convert .number. to [number]. | ||
path = path.replace(/\.(\d+)\./g, '[$1].'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you only need to bottom one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it depends if you want to support JSON dot notation or not.
SET @json = '{"tt": [1, 2, [3, 4]], "tt2" : 3}';
SELECT JSON_EXTRACT(@json, '$.tt.2'); // return null;
SELECT JSON_EXTRACT(@json, '$.tt[2]'); // return [3,4];
SELECT JSON_EXTRACT(@json, '$.tt[2].1'); // return null;
SELECT JSON_EXTRACT(@json, '$.tt[2][1]'); // return 4;
so supporting something like whereItemQuery(Sequelize.json('profile.id.0.1'), '1')
profile.id.0.1
needs to be changed to json_unquote(json_extract(profile
,'$.id[0][1]')) = '1'
resolve(results); | ||
}) | ||
.catch(err => { | ||
debug( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really useful to debug log and regular log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, a better thing may be
debug( `executed(${this.connection.uuid || 'default'}) with error : ${this.sql}\n${err}`);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, keep this format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @rusher Let me know if there is any thing pending. Will merge this on Monday
@sushantdhiman No other changes unless new reviews |
Thanks @rusher 👍 (& @SimonSchick for additonal reviews) :) |
Pull Request check-list
Please make sure to review and check all of these items:
npm run test
ornpm run test-DIALECT
pass with this change (including linting)?Description of change
Implementation of MariaDB.
This differs from MySQL mostly for 3 things:
Breaking change is the use of schemas. MySQL/MariaDB have schemas, but no "default" public schema.
Current implementation for MySQL will create a table with name
mySchema_myTable
, using schema, that ismySchema
.myTable
.I haven't corrected that for MySQL since it will break every existing application, but for new MariaDB implementation, it seems appropriate to use a better base with real schemas.
Tests have been updated accordingly (defaut method that drop all schemas is replace to keep default schema that is needed for MariaDB)