0.0.144 • Published 6 days ago

@malloydata/malloy v0.0.144

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

Malloy

Malloy is an experimental language for describing data relationships and transformations. It is both a semantic modeling language and a querying language that runs queries against a relational database. Malloy currently connects to BigQuery and Postgres, and natively supports DuckDB. We've built a Visual Studio Code extension to facilitate building Malloy data models, querying and transforming data, and creating simple visualizations and dashboards.

Building applications or products in javascript with @malloydata/malloy

This package facilitates building the Malloy language - or the usage of data models or queries written in the Malloy language - into your product, data application, or website. The @malloydata/malloy library translates complex data operations written in the Malloy language into 1) SQL and 2) metadata. The SQL can be run against a database, and then combined with results and rendered or used in a varitey of ways.

Show me an example!

const malloy = require("@malloydata/malloy")
const bigquery = require("@malloydata/db-bigquery")

const connection = new bigquery.BigQueryConnection("bigquery");
const runtime = new malloy.SingleConnectionRuntime(connection);
const model = runtime.loadModel("source: airports is bigquery.table('malloytest.airports')")
const runner = model.loadQuery("run: airports->{aggregate: airport_count is count()}")
runner.run().then((result) => {
    console.log(result.data.value) // [ { airport_count: 19793 } ]
})

Note: These APIs are still in beta and subject to change.

What's actually going on here?

The @malloydata/malloy is basically a compiler that takes a few things as input - 1. Some text that defines a Malloy data model 2. Some text that defines a Malloy query and 3. Some schema information about the table(s) the query might run against. The compiler works by attempting to compile the data model, and stopping compilation when it needs to ask for things it requires to continue compilation. This "loop" is then re-initiated when you provide the compiler with the additional information, until a point when the compiler has all the information it needs to compile a Malloy query based on a data model.

In practice, much of this loop is handled by various database plugins:

Do you have any examples?

You can find a (very) simple example of writing a CLI for executing Malloy queries here

A more realistic and complex use case - we use these libraries to power our VSCode Extension. Some examples can be found here

0.0.144

6 days ago

0.0.143

13 days ago

0.0.142

19 days ago

0.0.141

21 days ago

0.0.140

23 days ago

0.0.138

24 days ago

0.0.137

1 month ago

0.0.136

1 month ago

0.0.135

1 month ago

0.0.134

1 month ago

0.0.133

1 month ago

0.0.132

1 month ago

0.0.131

2 months ago

0.0.129

2 months ago

0.0.130

2 months ago

0.0.128

2 months ago

0.0.127

2 months ago

0.0.126

2 months ago

0.0.125

2 months ago

0.0.124

3 months ago

0.0.123

3 months ago

0.0.122

3 months ago

0.0.121

3 months ago

0.0.120

3 months ago

0.0.119

3 months ago

0.0.118

4 months ago

0.0.117

4 months ago

0.0.116

4 months ago

0.0.115

5 months ago

0.0.114

5 months ago

0.0.113

5 months ago

0.0.112

5 months ago

0.0.111

5 months ago

0.0.106

5 months ago

0.0.105

5 months ago

0.0.104

5 months ago

0.0.103

6 months ago

0.0.109

5 months ago

0.0.108

5 months ago

0.0.107

5 months ago

0.0.102

6 months ago

0.0.101

6 months ago

0.0.100

6 months ago

0.0.85

8 months ago

0.0.86

7 months ago

0.0.87

7 months ago

0.0.88

7 months ago

0.0.89

7 months ago

0.0.80

8 months ago

0.0.81

8 months ago

0.0.82

8 months ago

0.0.83

8 months ago

0.0.73

9 months ago

0.0.74

9 months ago

0.0.75

9 months ago

0.0.76

9 months ago

0.0.77

9 months ago

0.0.78

9 months ago

0.0.79

8 months ago

0.0.70

9 months ago

0.0.71

9 months ago

0.0.62

9 months ago

0.0.63

9 months ago

0.0.64

9 months ago

0.0.65

9 months ago

0.0.66

9 months ago

0.0.67

9 months ago

0.0.68

9 months ago

0.0.69

9 months ago

0.0.60

10 months ago

0.0.61

9 months ago

0.0.59

10 months ago

0.0.51

10 months ago

0.0.52

10 months ago

0.0.53

10 months ago

0.0.54

10 months ago

0.0.55

10 months ago

0.0.56

10 months ago

0.0.57

10 months ago

0.0.58

10 months ago

0.0.110

5 months ago

0.0.95

6 months ago

0.0.96

6 months ago

0.0.97

6 months ago

0.0.98

6 months ago

0.0.99

6 months ago

0.0.90

7 months ago

0.0.91

7 months ago

0.0.92

7 months ago

0.0.93

7 months ago

0.0.94

7 months ago

0.0.47

10 months ago

0.0.50

10 months ago

0.0.48

10 months ago

0.0.49

10 months ago

0.0.40

11 months ago

0.0.41

11 months ago

0.0.42

11 months ago

0.0.43

10 months ago

0.0.44

10 months ago

0.0.45

10 months ago

0.0.46

10 months ago

0.0.37

11 months ago

0.0.38

11 months ago

0.0.39

11 months ago

0.0.32

12 months ago

0.0.33

12 months ago

0.0.34

11 months ago

0.0.35

11 months ago

0.0.36

11 months ago

0.0.30

1 year ago

0.0.31

1 year ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.28

1 year ago

0.0.29

1 year ago

0.0.24

1 year ago

0.0.25

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.20

1 year ago

0.0.21

1 year ago

0.0.15

1 year ago

0.0.16

1 year ago

0.0.17

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.10

1 year ago

0.0.11

1 year ago

0.0.12

1 year ago

0.0.13

1 year ago

0.0.14

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.3

2 years ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.2

2 years ago

0.0.1

2 years ago