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

feat(clusterbuster): Revamp queries to remove Slonik and allow overwrite of the base query #52

Merged
merged 1 commit into from
Jun 25, 2020

Conversation

cosmin-petrescu
Copy link

Now you can overwrite base query and you can have the data in multiple tables joined in the base query

…ite of the base query

Now you can overwrite base query and you can have the data in multiple tables joined in the base query
@cosmin-petrescu cosmin-petrescu merged commit 4da2914 into master Jun 25, 2020
@cosmin-petrescu cosmin-petrescu deleted the feat/allow-custom-filtered-query branch June 25, 2020 06:06
@cosmin-petrescu
Copy link
Author

🎉 This PR is included in version 2.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link
Contributor

@bartolkaruza bartolkaruza left a comment

Choose a reason for hiding this comment

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

I like the flexibility this gives! Removing the dependency on an external lib is also an improvement.

@cosmin-petrescu small note, the reason for adding slonik was to prevent SQL injection (it handles value binding). Perhaps it would be good to test for that? I think x,y,z should be passed as value instead of directly in SQL, which is easy to do without slonik (see my other comments).

Additionally, maybe this new property could use a small doc mention?

attributes,
}: ITileQuery) => `
SELECT
ST_AsMVTGeom(ST_Transform(${geometry}, 3857), TileBBox(${z}, ${x}, ${y}, 3857), ${extent}, ${bufferSize}, false) AS geom,
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps z, x, y should be $1, $2, $3 and passed to the query as values instead of directly as SQL strings in the query

Copy link
Author

Choose a reason for hiding this comment

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

That would be an idea or we can make sure x, y and z are numbers. This way we make sure is not SQL injection. I'll make a PR for that.

});
const result = await pool.query(query.sql, query.values);
Copy link
Contributor

Choose a reason for hiding this comment

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

even without slonik, values should be used instead of directly putting SQL strings in the query

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants