Coder Social home page Coder Social logo

bdash-server's Introduction

Bdash Server

This is a web app to share SQLs for data analysis from Bdash.

The features are:

  1. Share as a web page your SQL, query results and charts from Bdash client.
  2. Add descriptions to your query.
  3. Search queries of all users.

screenshot

Bdash Server is powered by Blitz.js using Next.js and Prisma.

Setup

Make your own .env.local from .env.local.example for development.

$ cp .env.local.example .env.local

And write your own GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET for OAuth.

You can generate OAuth web client ID by following the steps described in: https://support.google.com/workspacemigrate/answer/9222992.

After that,

  • Set http://localhost:3000 as Authorized JavaScript origins
  • Set http://localhost:3000/api/auth/google/callback as Authorized redirect URIs

Run

$ yarn dev

Docker is required. 🐳

Run db:migrate to setup database.

$ yarn db:migrate

Open http://localhost:3000 with your browser to see the result.

Run production mode (NODE_ENV=production) on local machine

Run an app container with the image built by Dockerfile for production.

docker compose -f docker-compose-with-app-container.yml up --build

Tests

yarn test

License

MIT

bdash-server's People

Contributors

eagletmt avatar funwarioisii avatar hokaccha avatar morishin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bdash-server's Issues

Suggestion: do not update description in shared updates

Hi.
I am using bdash server and app to share queries and their execution results.
And I often write the query description in bdash server.
But when I update the query and the results from the app, the description is overwritten.

Wouldn't it be more convenient if the description is not updated?

Bdash app version: 1.15.2 (1.15.2)

Crash with Node.js v16

I could not sign in local bdash-server with Node.js v16 (or v17) because of crash. bdash-server with Node.js v14 works well.
Node.js v14 is still maintained over a year but the current active LTS is v16.
https://nodejs.org/en/about/releases/

% node --version
v16.13.2
% yarn dev

Opening http://localhost:3000 and proceed login or sending a valid session cookie causes Node.js crash.

% curl 'http://localhost:3000/api/users/queries/getCurrentUser' -X POST -H 'Content-Type: application/json' -H 'Cookie: bdash-server_sSessionToken=*REDACTED*' -d '{"params":null,"meta":{}}'
/usr/bin/node[29161]: ../src/node_http_parser.cc:567:static void node::{anonymous}::Parser::Initialize(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `args[3]->IsInt32()' failed.
 1: 0x55e263debd25 node::Abort() [/usr/bin/node]
 2: 0x55e263dec074 node::Assert(node::AssertionInfo const&) [/usr/bin/node]
 3: 0x55e263e07a75  [/usr/bin/node]
 4: 0x55e26403b6e8 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/bin/node]
 5: 0x55e26403beb2  [/usr/bin/node]
 6: 0x55e26403c332 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
 7: 0x55e26486eb19  [/usr/bin/node]

SQL文より結果を先に表示してほしい

bdash servcerのページURLを開くときにユーザーが関心があるのは、SQL文ではなく、実行結果であることのほうが多いと思うので、実行結果→SQLの順に並び替えると良いと思ったのですがどうでしょうか?

Unable to share chart with long column names

When I run query with relatively long column names like select * from (values (1, 2), (2, 4)) as t(long_name_column_x, long_name_result) and share its chart, bdash-server returns 500 because BdashQuery.chart_config column is too short.

image

Local bdash-server logs:

prisma:query BEGIN
prisma:query INSERT INTO `bdash_server_dev`.`BdashQuery` (`id_hash`,`createdAt`,`updatedAt`,`userId`,`title`,`description`,`query_sql`,`data_source_info`,`chart_svg`,`chart_config`,`result`) VALUES (?,?,?,?,?,?,?,?,?,?,?)
prisma:query ROLLBACK
PrismaClientKnownRequestError2 [PrismaClientKnownRequestError]:
Invalid `prisma.bdashQuery.create()` invocation:


  The provided value for the column is too long for the column's type. Column: chart_config
    at cb (/home/eagletmt/.clg/github.com/bdash-app/bdash-server/node_modules/@prisma/client/runtime/index.js:78689:17)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async postBdashQuery (/home/eagletmt/.clg/github.com/bdash-app/bdash-server/.next/server/pages/api/bdash-query/create.js:244:22)
    at async apiResolver (/home/eagletmt/.clg/github.com/bdash-app/bdash-server/node_modules/next/dist/next-server/server/api-utils.js:8:1)
    at async DevServer.handleApiRequest (/home/eagletmt/.clg/github.com/bdash-app/bdash-server/node_modules/next/dist/next-server/server/next-server.js:64:462)
    at async Object.fn (/home/eagletmt/.clg/github.com/bdash-app/bdash-server/node_modules/next/dist/next-server/server/next-server.js:56:492)
    at async Router.execute (/home/eagletmt/.clg/github.com/bdash-app/bdash-server/node_modules/next/dist/next-server/server/router.js:23:67)
    at async DevServer.run (/home/eagletmt/.clg/github.com/bdash-app/bdash-server/node_modules/next/dist/next-server/server/next-server.js:66:1042)
    at async DevServer.handleRequest (/home/eagletmt/.clg/github.com/bdash-app/bdash-server/node_modules/next/dist/next-server/server/next-server.js:34:504) {
  code: 'P2000',
  clientVersion: '2.17.0',
  meta: { column_name: 'chart_config' }
}

グラフをリッチにしたい

SVG画像をやめる。TSVデータからJSでグラフを描画して、マウスオーバーで値が表示されるようなやつにしたい

SQLを手元のBdashに落としたい

実行とまでは言わないので「誰かが書いたクエリを手元に持ってきて自分でも書き換えて実行してみる」の流れをスムーズにしたい。
VSC拡張機能の InstallボタンのようにWebブラウザからBdashへ繋げるフローが作れればよさそう。

クエリの更新

一度 bdash-server に publish してから同じクエリを編集して再度 publish したとき現行仕様だと新規に URL が発行されるが、同じ URL で中身を更新するようにしたい。

Bdash クライアントアプリにも手を入れる必要がある。

Bdash クライアントから bdash-server に POST した時、そのレスポンスからクエリの ID (hash) を取得してクライアントの DB にクエリに紐づく形で保持しておいて、再 publish の時は新規・更新を選べるようにして、更新であれば保存していた ID (hash) 宛に PUT リクエストというイメージ 💭

SQLを編集したい

bdashのクエリー欄には複数クエリーを書くことができるので、実際に実行されたクエリーだけを残して、他は消してしまいたいことが多い。クエリーを編集可能になると嬉しい。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.