Published
Edited
Dec 11, 2020
1 fork
3 stars
Insert cell
Insert cell
MapdCon = require("@mapd/connector@5/dist/browser-connector.js").catch(() => window.MapdCon)
Insert cell
Insert cell
connector = new MapdCon()
.protocol("https")
.host("metis.mapd.com")
.port("443")
.dbName("mapd")
.user("mapd")
.password("HyperInteractive")
.connectAsync()
Insert cell
Insert cell
connector.getTablesAsync()
Insert cell
Insert cell
n = connector.queryAsync(`SELECT
COUNT(*) AS n
FROM tweets_nov_feb
WHERE country='CO'`)
Insert cell
Insert cell
connector.getFieldsAsync("flights_donotmodify")
Insert cell
Insert cell
data = connector.queryAsync(`SELECT
carrier_name, AVG(airtime) AS avg_airtime
FROM flights_donotmodify
WHERE airtime IS NOT NULL
GROUP BY carrier_name
ORDER BY avg_airtime
DESC LIMIT 100`)
Insert cell
Insert cell
vegalite({
data: {values: data},
mark: {type: "bar"},
width,
height: 600,
autosize: "fit",
encoding: {
x: {field: "avg_airtime", type: "quantitative", axis: {orient: "top"}},
y: {field: "carrier_name", type: "nominal", sort: null, axis: {title: null}}
}
})
Insert cell
vegalite = require("@observablehq/vega-lite@0.1")
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more