Hi I have a requirement wherein I need to embed the mapd crossfilter js generated SQL in my Mapd vega specs.
I need to extract the SQL formed by the mapd crossfilter library and embed it in my vega spec and further prohibit the mapd crossfilter library from making mapd connections.
Need to extract SQL from mapd crossfilter
The new Tweetmap application code shows (https://github.com/mapd/mapd-tweetmap-2) how to use the crossfilter API from your Javascript code. You can refer to /src/services/crossfilter.js for creating the crossfilter object. The file actions.js under src/components/Legend, src/components/MapBody and src/components/TweetSidebar, shows how to use the crossfilter object to then pass the table dimensions. You can refer to the function groupAll() in mapd/mapd-crossfilter/src/mapd-crossfilter.js to see the construction of the SQL query.
Reference: https://www.mapd.com/blog/data-viz-tweetmap-mapd/
Thanks for your reply, let me be more specific I need to access Crossfilter.writeQuery method from outside the mapd crossfilter library, how may I do that? Is there any workaround.
Hi Sachinpkaushik,
Unfortunately it might be difficult to return the raw query with the current implementation. You will likely need to fork CrossFilter and expose the function manually by adding:
writeQuery: writeQuery
around here.
One caveat to be aware of is there are a few functions of writeQuery
within crossFilter, so you might have to expose writeQuery
in several areas such as the dimension
and group
functions.