metabase / macaw Goto Github PK
View Code? Open in Web Editor NEWA Clojure wrapper for JSqlParser ๐ฆ
License: Eclipse Public License 1.0
A Clojure wrapper for JSqlParser ๐ฆ
License: Eclipse Public License 1.0
GITHUB_TOKEN
CLOJARS_USERNAME
CLOJARS_PASSWORD
deploy.yml
, edit if neededInstead of just taking a column/table name, replace-names
should take {:table "foo" :column "bar" :schema "baz"}
maps
SELECT
count(id)
FROM
orders
GROUP BY user_id
finds id
but not user_id
(in the same way that you can rename columns and tables)
Bryan made the cogent suggestion to add Malli schemas to function metadata as a means of documentation and we've been planning for a while to Malli-fy everything. All public functions and constants should have schemas.
If you have something like
select public.towns.id from towns
Macaw won't catch that towns
must have a schema of public
in :tables
But fails
(deftest complicated-mutations-test
(is (= #{"delete" "insert"}
(mutations "WITH outdated_orders AS (
DELETE FROM orders
WHERE
date <= '2018-01-01'
RETURNING *
)
INSERT INTO order_log
SELECT * from outdated_orders;"))))
with
macaw.core-test
1 non-passing tests:
Error in complicated-mutations-test
expected: (=
#{"delete" "insert"}
(mutations
"WITH outdated_orders AS (
DELETE FROM orders
WHERE
date <= '2018-01-01'
RETURNING *
)
INSERT INTO order_log
SELECT * from outdated_orders;"))
error: net.sf.jsqlparser.JSQLParserException: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "DELETE" "DELETE"
at line 2, column 24.
Was expecting:
"WITH"
Similar to the work done in metabase/metabase#41781
When we call replace-names
, we should handle case and quoting correctly. Currently it depends on an exact string match.
(deftest tables-with-complex-aliases-test
(testing "With an alias that is also a table name"
(is (= #{"user" "user2_final"}
(tables
"SELECT legacy_user.id AS old_id,
user.id AS new_id
FROM user AS legacy_user
OUTER JOIN user2_final AS user
ON legacy_user.email = user2_final.email;")))))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.