GithubHelp home page GithubHelp logo

hvf / franchise Goto Github PK

View Code? Open in Web Editor NEW
4.0K 103.0 281.0 2.01 MB

๐ŸŸ a notebook sql client. what you get when have a lot of sequels.

Home Page: https://franchise.cloud

License: MIT License

JavaScript 92.50% HTML 1.04% CSS 4.48% Dockerfile 0.06% Shell 0.01% TSQL 1.90%
sql mysql postgresql bigquery database

franchise's Introduction

Franchise

a sql notebook

Franchise is a lightweight but powerful SQL tool with a notebook interface. You can use it online at franchise.cloud.

Franchise is pretty cool

  • There's no sign up and no install
    • For editing CSVs, JSON, XLSX files, we've integrated js-xlsx, and sql.js so you can query data entirely locally in your browser
    • For connecting to PostgreSQL, MySQL, or BigQuery, just run a single command in your terminal to open a bridge that allows Franchise to directly connect to your database. Your data never touches a third party server.
  • Chart with a single click
  • Compare queries side by side

Running Locally (Development Mode)

There's an online version of franchise right here. There are also instructions for building franchise to static files here.

Otherwise, here's how to run franchise in development mode:

  1. If you don't have npm or yarn, install yarn.

  2. Open up a terminal and run

    git clone --depth 1 https://github.com/HVF/franchise.git
  3. cd into the project directory

    cd franchise
  4. Install the project dependencies

    yarn install

    (you can also run npm install)

  5. Start the dev server

    yarn start

    (you can also run npm start)

  6. Open up a browser and go to http://localhost:3000

  7. Edit some files in franchise/src.

    When you save your edits, and the browser will automatically reload.

  8. (optional) Add a bunch of great functionality and send a PR!


Running in Docker ๐Ÿณ

Application will be available here: http://localhost:3000

Using Docker Hub image

docker run \
    --name franchise \
    -p 3000:80 \
    -p 14645:14645 \
    -d binakot/franchise

Build your own image

  1. Build a docker image:
docker build -t franchise .
  1. Run a container with image:
docker run \
    --name franchise \
    -p 3000:80 \
    -p 14645:14645 \
    -d franchise

Build electron app

Linux:

yarn build:electron:linux

macOS:

yarn build:electron:mac

Windows:

yarn build:electron:windows

After build check out dist folder.

franchise's People

Contributors

20after4 avatar antimatter15 avatar bijection avatar binakot avatar chrismanderson avatar dependabot[bot] avatar kbrandwijk avatar limonte avatar mazulatas avatar roastveg avatar sheetjsdev 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  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  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  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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

franchise's Issues

connect postgresql but cann't connect

i run i Run npx [email protected] in centos6.5 machine,and i got this message.
npx: 138 ๅฎ‰่ฃ…ๆˆๅŠŸ๏ผŒ็”จๆ—ถ 27.67 ็ง’
franchise-client listening on port 14645

but in browse,the connect button is cann't use still, how to resolve it

Hooks for when a query is run

A hook/event for when a query is run/sent to the database would enable easy audit logging of the queries sent.

I'm willing to add this myself if it's something you guys would be open to supporting. Could maybe be done using an event emitter.

Connecting forever when information_schema returns empty

This is misleading. When bridge is connected and database responde with empty in information_schema app looks like connecting forever even when logs show now further actions. This make problem hard to understand to the users.

Save sql files locally?

Hi there!

Just wondering if it's possible to run franchise locally and edit and save SQL files to local disk.

I'm looking for a lightweight SQL editor for files that can be checked in to a repo.

Use as desktop app in electron

Hello,

Is it in the plan to make a desktop version using electron? It would be a nice way to package it onto desktops.

Regards,
Alfredo Palhares

Can I translate into japanese?

I tried the franchise and I like it.

this is so beautiful and interesting and I wanna spread it.

So, Can I translate into japanese ?

franchise-client SyntaxError: missing ) after argument list

OSX
node v6.11.3

I'm having issues getting the franchise client bridge to work locally.

I've tried the following:

Benjamin@MacBook-Pro:~/projects/franchise$ npx franchise-client
missing ) after argument list
Benjamin@MacBook-Pro:~/projects/franchise/node_modules/franchise-client$ ./server.js 
/Users/Benjamin/projects/franchise/node_modules/franchise-client/server.js:16
	ws.on('message', async message => {
	                 ^^^^^

SyntaxError: missing ) after argument list
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)

I've added all env variables required by credentials.js to my env.
Any suggestions?
Thanks

some csv parsed wrong

example data is this current-loans-11-12.csv just pulled today from lendingclub developer's portal [this is public information to any lendingclub investor, no privacy information], I found franchise could be a good tool to do some exploratory analysis, however the csv parsing is wrong for some columns, like the INQ_LAST_12M column's valid value should be an integer in the range of [0,12] the github csv viewer can parse it correctly but why franchise parse this (and many other similar columns) with a lot of values like 36852, 36951, ...
https://gist.github.com/anonymous/3ea1bc242b460e869433c55a4cb28450
https://www.lendingclub.com/developers/listed-loans.action

inqLast12m Integer Yes Number of credit inquiries in past 12 months.

image

BTW: if https://franchise.cloud/app/ has a feature to save and share, make it a service like jupyter notebook for people to share and exchange analysis on public data, then it could be more popular!

table data serialized and displayed as [object Object]

I'm seeing improperly serialized query results with column values displayed like this:

[object Object]

Here is the schema for one of the columns which franchise_client output to the terminal:

{   catalog: 'def',
    schema: 'phabricator_maniphest',
    name: 'ownerPHID',
    orgName: 'ownerPHID',
    table: 'maniphest_task',
    orgTable: 'maniphest_task',
    characterSet: 63,
    columnLength: 64,
    columnType: 253,
    flags: 16520,
    decimals: 0 }

When I display the results in card view, I get something different:

{"type":"Buffer","data":[80,72,73,68,45,85,83,69,82,45,51,107,99,104,119,107,53,53,100,110]}

So it looks like the individual bytes are sent as an array of integers. Is there any way to get franchise to treat those as unicode characters and display them?

ClickHouse Support

ClickHouse is a very good database for data analysis.

Hope the support of ClickHouse

Add query timing information

I just discovered franchise and really like it. I think adding timings to the querys would be a great addition to the tool

BigQuery Schema Fetch Fails When Number of Tables > Linux ulimit

If the number of tables in a BigQuery project is greater than the limit on files/sockets imposed by ulimit on the user running franchise-client, the number of connections to BigQuery exceeds this limit and throws an EMFILE error.

This prevents users with large numbers of tables in their BigQuery projects from using franchise.

JDBC Database Support

What is needed to support jdbc databases?

My personal favourite is SnappyData. It has a thrift interface but directly supporting jdbc means a number of databases can be connected with less effort.

This is awesome!

Thank you for making this and for open sourcing it! I've built a similar thing specifically for Wikimedia a long time ago - https://quarry.wmflabs.org, but this looks cooler and more modern! I hope to try to set this up at Wikimedia when time permits.

Dist App Not Working

Hey, I used your online demo and I really liked it but when I try to build it I had problem that says you have to remove "electron" package from dependencies. I removed it on package.json file then build with "yarn dist" command. It created application but app is not starting. App is stuck on this screen:

screen shot 2017-09-15 at 11 39 09

So my question is can you pre-build app and release binaries on releases section on github?

Thanks

Advice for running in a sandbox: Invalid Host Header

Any idea how I can combat the "Invalid Host Header" error? I am trying to see if I can get this running in a Sandstorm instance, but I don't know enough about webpack to figure out how to successfully disable this check. I tried adding --offline and --host 0.0.0.0 in the package file for yarn start.

User is able to drop tables

Current behaviour:

  • Users are currently able to do destructive queries against DBs (DROP TABLE, DELETE, etc). They are also able to add data (INSERT, etc).

Expected behaviour:

  • Users should not be allowed to submit queries that can delete, add or change data. (This can be configured in some databases by creating a readonly user)

Possible solutions:

Application fixes:

  • I'd suggest using the ast from the codeschool sqlite-parser, walking the ast with sqltraverse (yup it's a shameless plug ๐Ÿ˜‹ ). That way you can check for subqueries that may cause issues and notify the user.

Databases admin fixes:

  • Create a read only user for the application to use:
  • MySQL:
grant select on database_name.* to 'read-only_user_name'@'%' identified by 'password';
  • PostgreSQL:
psql databasehere
CREATE USER moodle_readonly WITH ENCRYPTED PASSWORD 'blablablapasswordhere';
GRANT CONNECT ON DATABASE moodle TO moodle_readonly;
GRANT USAGE ON SCHEMA public TO moodle_readonly;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO moodle_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA public to moodle_readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO moodle_readonly;

package.json electron should be in devDependencies

$ npm run dist
...
electron-builder 19.36.0
Error: Package "electron" is only allowed in "devDependencies". Please remove it from the "dependencies" section in your package.json.

Moving electron from dependencies to devDependencies works

I cannot "npm start"

hi. I want to try franchise with my pc. but I cannot "npm start".

Can somebody help me?

node.js ==> v8.5.0( using nodist )
npm ==> v4.0.5( nwb is installed )
OS ==> windows7 home 64bit

I installed franshise following "Running Locally"

this is the error.


E:\github\franchise>npm start

> [email protected] start E:\github\franchise
> nwb serve-react-app

Error running command: Cannot find module 'nwb-less' from 'E:\github\franchise'
Error: Cannot find module 'nwb-less' from 'E:\github\franchise'
    at Function.module.exports [as sync] (C:\Program Files (x86)\Nodist\bin\node
_modules\nwb\node_modules\resolve\lib\sync.js:40:15)
    at C:\Program Files (x86)\Nodist\bin\node_modules\nwb\lib\getPluginConfig.js
:71:50
    at Array.forEach (<anonymous>)
    at getPluginConfig (C:\Program Files (x86)\Nodist\bin\node_modules\nwb\lib\g
etPluginConfig.js:70:11)
    at webpackServer (C:\Program Files (x86)\Nodist\bin\node_modules\nwb\lib\web
packServer.js:91:54)
    at serve (C:\Program Files (x86)\Nodist\bin\node_modules\nwb\lib\appCommands
.js:161:31)
    at serveReact (C:\Program Files (x86)\Nodist\bin\node_modules\nwb\lib\comman
ds\serve-react-app.js:18:26)
    at cli (C:\Program Files (x86)\Nodist\bin\node_modules\nwb\lib\cli.js:263:5)

    at Object.<anonymous> (C:\Program Files (x86)\Nodist\bin\node_modules\nwb\li
b\bin\nwb.js:31:21)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Function.Module.runMain (module.js:665:10)
    at startup (bootstrap_node.js:201:16)
    at bootstrap_node.js:626:3

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files (x86)\\Nodist\\v-x64\\8.5.0\\node.exe" "C:\\Pro
gram Files (x86)\\Nodist\\npmv\\4.0.5\\bin\\npm-cli.js" "start"
npm ERR! node v8.5.0
npm ERR! npm  v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `nwb serve-react-app`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'nwb serve-react-app'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the franchise package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     nwb serve-react-app
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs franchise
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls franchise
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to in
stall?

npm ERR! Please include the following file with any support request:
npm ERR!     E:\github\franchise\npm-debug.log

E:\github\franchise>

'Download notebook' missing filename (safari)

Using Safari Version 11.0 (13604.1.38.1.6)

Problem

Clicking the 'Download' button in the notebook downloads prompts for a name then initiates the download, but the downloaded file is always named 'unknown'.

In the example below, I created a fresh notebook & added new data before trying to download. I believe the problem also occurs with the example notebooks.

franchise_no_filename_safari

Query editor errors when referencing previous cells

Looks like you're not allowed to use aliases. This code fails

SELECT
   b.myvalue
FROM 
    {{myquery}} as b

Wrapping the cell reference within parentheses doesn't work either:

SELECT
   b.myvalue
FROM 
    ({{myquery}}) b

And when you want to reference more than one cell with same columns and need to specify the table name, also fails (circular reference https://github.com/HVF/franchise/blob/master/src/db/generic.js#L98 )

SELECT
   {{myquery1}}.id
   {{myquery1}}.myvalue as val1, 
   {{myquery2}}.myvalue as val2
FROM 
    {{myquery_1}} ,
    {{myquery_2}}
USING (id)

Too many rows to serialize on postgres

I think the initialization is struggling with the amount of data in my database and it's timing out. Can you add an option to not serialize?

Error:

received: {"action":"exec","sql":"SELECT table_schema, table_name, column_name\n            FROM information_schema.columns \n            WHERE table_schema not in ('pg_catalog', 'information_schema', 'pg_internal')","id":3}
Error: Too many result rows to serialize: Try using a LIMIT statement.

LICENSE.md needed

There is not currently a license clause in the source code repo/contributing document.

"npx [email protected]" fails

2017-10-02T08_43_52_006Z-debug.log
Maybe this is a bug with npm or npx, but I'm unable to start the franchise-client.
OS is macOS Sierra Version 10.12.6, node version is v8.6.0 and npm version is v5.3.0.

MacBook-Air:SomeDir$ LANG=en npx [email protected]
npm ERR! path /Users/heiko/.npm/_npx/6099/lib/node_modules/franchise-client/lib/server.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/heiko/.npm/_npx/6099/lib/node_modules/franchise-client/lib/server.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm E
2017-10-02T08_43_52_006Z-debug.log
RR! /Users/heiko/.npm/_logs/2017-10-02T08_43_52_006Z-debug.log
Install for [email protected] failed with code 254

The directory /Users/heiko/.npm/_npx/ is completely empty.

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.