Skip to content

Commit

Permalink
MySQL in Malloy (from Fernando's Repo) (#1948)
Browse files Browse the repository at this point in the history
* MySQL in Malloy (from Fernando's Repo)

* simplification of the query interface and beginning to nest.

* Get basic nesting to work.

* rework get description for SQL block

* Fix symmetric aggregates.

* add notation for native booleans

* boolean logic in tests

* MySQL doesn't support FULL JOIN
UNNEST Support for pipelines

* An attempt at nested pipelines (failing still)
turning off features mysql doesn't support

* Update the group_concat_max

* '*' comes first in select.

* Filtered sources,
Unnest redux
casting

* booleanResult for boolean results.

* Adding Functions

* more functions.

* More tests.

* more functions.  trim is weird.

* more attempts to fix

* handle version weirdness

* update for structdef

* string_agg:

* Fix tests.

* Remove mysql test for now

* stub test.

* rename so it doesn't get called.

* remove test

---------

Co-authored-by: Michael Toy <66150587+mtoy-googly-moogly@users.noreply.github.com>
  • Loading branch information
lloydtabb and mtoy-googly-moogly authored Oct 7, 2024
1 parent 06dca1d commit 1631bc9
Show file tree
Hide file tree
Showing 34 changed files with 1,486 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prerelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- main
runs-on: ubuntu-latest
env:
PACKAGES: 'packages/malloy-interfaces packages/malloy packages/malloy-db-bigquery packages/malloy-db-duckdb packages/malloy-db-postgres packages/malloy-db-snowflake packages/malloy-db-trino packages/malloy-render packages/malloy-malloy-sql test packages/malloy-syntax-highlight'
PACKAGES: 'packages/malloy-interfaces packages/malloy packages/malloy-db-bigquery packages/malloy-db-duckdb packages/malloy-db-postgres packages/malloy-db-snowflake packages/malloy-db-trino packages/malloy-db-mysql packages/malloy-render packages/malloy-malloy-sql test packages/malloy-syntax-highlight'
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- main
runs-on: ubuntu-latest
env:
PACKAGES: 'packages/malloy-interfaces packages/malloy packages/malloy-db-bigquery packages/malloy-db-duckdb packages/malloy-db-postgres packages/malloy-db-snowflake packages/malloy-db-trino packages/malloy-render packages/malloy-malloy-sql test packages/malloy-syntax-highlight'
PACKAGES: 'packages/malloy-interfaces packages/malloy packages/malloy-db-bigquery packages/malloy-db-duckdb packages/malloy-db-postgres packages/malloy-db-snowflake packages/malloy-db-trino packages/malloy-db-mysql packages/malloy-render packages/malloy-malloy-sql test packages/malloy-syntax-highlight'
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion cloudbuild/deploy/malloy-npm-publish.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euxo pipefail

export PACKAGES="packages/malloy-interfaces packages/malloy packages/malloy-db-bigquery packages/malloy-db-duckdb packages/malloy-db-postgres packages/malloy-db-snowflake packages/malloy-db-trino packages/malloy-render packages/malloy-malloy-sql test packages/malloy-syntax-highlight"
export PACKAGES="packages/malloy-interfaces packages/malloy packages/malloy-db-bigquery packages/malloy-db-duckdb packages/malloy-db-postgres packages/malloy-db-snowflake packages/malloy-db-trino packages/malloy-db-mysql packages/malloy-render packages/malloy-malloy-sql test packages/malloy-syntax-highlight"

nix-shell --pure --keep NPM_TOKEN --keep PACKAGES --command "$(cat <<NIXCMD
set -euxo pipefail
Expand Down
2 changes: 1 addition & 1 deletion cloudbuild/deploy/malloy-npm-release-publish.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euxo pipefail

export PACKAGES="packages/malloy-interfaces packages/malloy packages/malloy-db-bigquery packages/malloy-db-duckdb packages/malloy-db-postgres packages/malloy-db-snowflake packages/malloy-db-trino packages/malloy-render packages/malloy-malloy-sql test packages/malloy-syntax-highlight"
export PACKAGES="packages/malloy-interfaces packages/malloy packages/malloy-db-bigquery packages/malloy-db-duckdb packages/malloy-db-postgres packages/malloy-db-snowflake packages/malloy-db-trino packages/malloy-db-mysql packages/malloy-render packages/malloy-malloy-sql test packages/malloy-syntax-highlight"

nix-shell --pure --keep NPM_TOKEN --keep PACKAGES --keep BRANCH_NAME --command "$(cat <<NIXCMD
set -euxo pipefail
Expand Down
157 changes: 157 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"packages/malloy-db-bigquery",
"packages/malloy-db-trino",
"packages/malloy-db-duckdb",
"packages/malloy-db-mysql",
"packages/malloy-db-postgres",
"packages/malloy-db-snowflake",
"packages/malloy-malloy-sql",
Expand Down Expand Up @@ -47,6 +48,7 @@
"@babel/preset-env": "^7.23.2",
"@jest/globals": "^26.6.2",
"@malloydata/db-bigquery": "*",
"@malloydata/db-mysql": "*",
"@malloydata/malloy": "*",
"@malloydata/render": "*",
"@types/fs-extra": "^9.0.13",
Expand Down
4 changes: 4 additions & 0 deletions packages/malloy-db-mysql/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src/
*.map
tsconfig*
*.spec
31 changes: 31 additions & 0 deletions packages/malloy-db-mysql/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@malloydata/db-mysql",
"version": "0.0.196",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=18"
},
"homepage": "https://github.com/malloydata/malloy#readme",
"repository": {
"type": "git",
"url": "https://github.com/malloydata/malloy"
},
"scripts": {
"lint": "eslint '**/*.ts{,x}'",
"lint-fix": "eslint '**/*.ts{,x}' --fix",
"test": "jest --config=../../jest.config.js",
"build": "tsc --build",
"clean": "tsc --build --clean",
"malloyc": "ts-node ../../scripts/malloy-to-json",
"prepublishOnly": "npm run build"
},
"dependencies": {
"@malloydata/malloy": "^0.0.196",
"@types/node": "^22.7.4",
"fastestsmallesttextencoderdecoder": "^1.0.22",
"luxon": "^3.5.0",
"mysql2": "^3.11.3"
}
}
8 changes: 8 additions & 0 deletions packages/malloy-db-mysql/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

export {MySQLConnection, MySQLExecutor} from './mysql_connection';
Loading

0 comments on commit 1631bc9

Please sign in to comment.