Skip to content

Commit 2c944e8

Browse files
Add example Observable notebook to readme, importing via esm.sh
This replaces Skypack, and actually works now. It's possible to import bundled modules from https://esm.sh, which will also import any required dependencies (unlike Sypack). This means that any environment supporting ESM imports, including Observable notebooks, browsers, and Deno can import `@madatdata/core` with one line of JS from a bundling CDN, and call it without doing any dependency management. Accordingly, restore the Observable example in the readme, replacing Skypack with esm.sh, and update the notebook: https://observablehq.com/@milesrichardson/madatdata-esm-splitgraph-client
1 parent 88c656d commit 2c944e8

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

README.md

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,21 @@ client
102102
.catch(console.trace);
103103
```
104104

105-
### Query Splitgraph with SQL from Observable notebooks
105+
### Query Splitgraph with SQL from Observable notebooks, browsers or Deno using ESM Modules
106106

107-
For Observable, you might be more interested in using Seafowl with the native
108-
[Seafowl Observable client](https://observablehq.com/@seafowl/client), like in
109-
this
110-
[example notebook](https://observablehq.com/@seafowl/interactive-visualization-demo).
107+
You can import the Madatdata client via a bundling CDN like [esm.sh]esm-sh,
108+
which should work in any environment where ES modules are supported, including
109+
browsers and Deno.
111110

112-
_Note_: Importing Madatdata via Skypack is currently broken because the `crypto`
113-
module does not exist in browsers, which breaks Skypack imports.
111+
(Note: For Observable, you might be more interested in using Seafowl with the
112+
native [Seafowl Observable client][seafowl-observable-client], like in this
113+
[example notebook][seafowl-native-observable-demo].)
114114

115-
<details>
116-
<summary>Click Here to See the Example Anyway</summary>
115+
For example, this is the [code for an observable notebook to query data with
116+
madatdata][observable-esm-example] and plot it:
117117

118118
```js
119-
madatdata = import("https://cdn.skypack.dev/@madatdata/core@latest");
119+
madatdata = import("https://esm.sh/@madatdata/core@latest");
120120
client = madatdata.makeSplitgraphHTTPContext({ credential: null }).client;
121121
result = await client.execute(`
122122
select
@@ -144,11 +144,6 @@ Plot.plot({
144144
});
145145
```
146146

147-
Also see this
148-
[outdated example](https://observablehq.com/@milesrichardson/madatdata-client-testing).
149-
150-
</details>
151-
152147
### Query Splitgraph with SQL from Postgres on the server
153148

154149
All data on Splitgraph is available through a unified Postgres interface which
@@ -386,18 +381,20 @@ see [./CONTRIBUTING.md](./CONTRIBUTING.md)
386381
[splitgraph-connect-query]: https://www.splitgraph.com/connect/query
387382
[docs-sgr-cli]: https://www.splitgraph.com/docs/sgr-cli/introduction
388383
[docs-web-bridge-api]: https://www.splitgraph.com/docs/query/ddn-http
389-
[docs-splitgraph-yml]:
390-
https://www.splitgraph.com/docs/splitgraph.yml/introduction
391384
[strategy-pattern]: https://refactoring.guru/design-patterns/strategy
392385
[github-porsager-postgres]: https://github.com/porsager/postgres
393386
[github-cross-fetch]: https://github.com/lquixada/cross-fetch
394387
[github-node-pg]: https://github.com/brianc/node-postgres
395-
[observable-madatdata-testing]:
396-
https://observablehq.com/@milesrichardson/madatdata-client-testing
397388
[tsc-multi]: https://github.com/tommy351/tsc-multi
398389
[in-anger]:
399390
https://english.stackexchange.com/questions/30939/is-used-in-anger-a-britishism-for-something
400391
[splitgraph-graphql-api]: https://api.splitgraph.com/gql/cloud/unified/graphql
401392
[splitgraph-ddn]: https://www.splitgraph.com/connect
402393
[seafowl-flyio]:
403394
https://seafowl.io/docs/getting-started/tutorial-fly-io/part-2-deploying-to-fly-io
395+
[esm-sh]: https://esm.sh
396+
[observable-esm-example]:
397+
https://observablehq.com/@milesrichardson/madatdata-esm-splitgraph-client
398+
[seafowl-native-observable-demo]:
399+
https://observablehq.com/@seafowl/interactive-visualization-demo
400+
[seafowl-observable-client]: https://observablehq.com/@seafowl/client

0 commit comments

Comments
 (0)