Page MenuHomePhabricator

First working version
ClosedPublic

Authored by dcaro on Nov 22 2020, 8:26 PM.

Details

Maniphest Tasks
T268418: [sqlchecker] Create a simple service that accepts an sql query and returns if it's cross-db or not
Reviewers
dcaro
Patch without arc
git checkout -b D1187 && curl -L https://phabricator.wikimedia.org/D1187?download=true | git apply
Summary

This includes:

  • a validating function (very limited though)
  • a cross-db check function (very limited too)
    • Checking for 'join' + some '<db>.<table>' identifier

Signed-off-by: David Caro <david@dcaro.es>

Use two different checks for cross-db

Now there's two different libraries that check if a query hits
multiple databases, one uses the moz-sql-parse and another sqlparse
projects.

There's also a library call to get the list of databases used by the
query.

Fixes: T268418

Signed-off-by: David Caro <david@dcaro.es>

Test Plan

Ran locally and tested with curl.
Also ran the library against all the quarry queries and checked a few to get
false positives and false negatives.

Diff Detail

Repository
R2884 tool-sqlchecker
Branch
T268418_add_is_cross_dabasase
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 3286
Build 5447: arc lint + arc unit

Event Timeline

dcaro requested review of this revision.Nov 22 2020, 8:26 PM
dcaro created this revision.
This revision is now accepted and ready to land.Nov 22 2020, 8:26 PM