Giter Site home page Giter Site logo

nocodb / nocodb Goto Github PK

View Code? Open in Web Editor NEW
41.7K 351.0 2.7K 1.12 GB

🔥 🔥 🔥 Open Source Airtable Alternative

Home Page: https://nocodb.com

License: GNU Affero General Public License v3.0

JavaScript 7.67% Shell 0.28% Dockerfile 0.07% TypeScript 67.61% CSS 0.26% Vue 22.53% SCSS 0.33% PLpgSQL 1.06% TSQL 0.16% Smarty 0.02%
automatic-api airtable no-code no-code-database mysql postgresql sqlserver sqlite mariadb airtable-alternative

nocodb's Introduction

The Open Source Airtable Alternative

Turns any MySQL, PostgreSQL, SQL Server, SQLite & MariaDB into a smart spreadsheet.

Node version Conventional Commits

WebsiteDiscordCommunityTwitterRedditDocumentation

video avi

See other languages »

Join Our Team

Join Our Community

Stargazers repo roster for @nocodb/nocodb

Quick try

Docker

# for SQLite
docker run -d --name nocodb \
-v "$(pwd)"/nocodb:/usr/app/data/ \
-p 8080:8080 \
nocodb/nocodb:latest

# for MySQL
docker run -d --name nocodb-mysql \
-v "$(pwd)"/nocodb:/usr/app/data/ \
-p 8080:8080 \
-e NC_DB="mysql2://host.docker.internal:3306?u=root&p=password&d=d1" \
-e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \
nocodb/nocodb:latest

# for PostgreSQL
docker run -d --name nocodb-postgres \
-v "$(pwd)"/nocodb:/usr/app/data/ \
-p 8080:8080 \
-e NC_DB="pg://host.docker.internal:5432?u=root&p=password&d=d1" \
-e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \
nocodb/nocodb:latest

# for MSSQL
docker run -d --name nocodb-mssql \
-v "$(pwd)"/nocodb:/usr/app/data/ \
-p 8080:8080 \
-e NC_DB="mssql://host.docker.internal:1433?u=root&p=password&d=d1" \
-e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \
nocodb/nocodb:latest

To persist data in docker you can mount volume at /usr/app/data/ since 0.10.6. Otherwise your data will be lost after recreating the container.

If you plan to input some special characters, you may need to change the character set and collation yourself when creating the database. Please check out the examples for MySQL Docker.

Different commands just indicate the database that NocoDB will use internally for metadata storage, but that doesn't influence the ability to connect to a different database type.

Binaries

MacOS (x64)
curl http://get.nocodb.com/macos-x64 -o nocodb -L && chmod +x nocodb && ./nocodb
MacOS (arm64)
curl http://get.nocodb.com/macos-arm64 -o nocodb -L && chmod +x nocodb && ./nocodb
Linux (x64)
curl http://get.nocodb.com/linux-x64 -o nocodb -L && chmod +x nocodb && ./nocodb
Linux (arm64)
curl http://get.nocodb.com/linux-arm64 -o nocodb -L && chmod +x nocodb && ./nocodb
Windows (x64)
iwr http://get.nocodb.com/win-x64.exe -o Noco-win-x64.exe
.\Noco-win-x64.exe
Windows (arm64)
iwr http://get.nocodb.com/win-arm64.exe -o Noco-win-arm64.exe
.\Noco-win-arm64.exe

Docker Compose

We provide different docker-compose.yml files under this directory. Here are some examples.

git clone https://github.com/nocodb/nocodb
# for MySQL
cd nocodb/docker-compose/mysql
# for PostgreSQL
cd nocodb/docker-compose/pg
# for MSSQL
cd nocodb/docker-compose/mssql
docker-compose up -d

To persist data in docker, you can mount volume at /usr/app/data/ since 0.10.6. Otherwise your data will be lost after recreating the container.

If you plan to input some special characters, you may need to change the character set and collation yourself when creating the database. Please check out the examples for MySQL Docker Compose.

NPX

You can run the below command if you need an interactive configuration.

npx create-nocodb-app

Node Application

We provide a simple NodeJS Application for getting started.

git clone https://github.com/nocodb/nocodb-seed
cd nocodb-seed
npm install
npm start

GUI

Access Dashboard using: http://localhost:8080/dashboard

Screenshots

2 3 4 5

5 7 8

8 9 10 11 12

Table of Contents

Features

Rich Spreadsheet Interface

  • ⚡  Basic Operations: Create, Read, Update and Delete Tables, Columns, and Rows
  • ⚡  Fields Operations: Sort, Filter, Hide / Unhide Columns
  • ⚡  Multiple Views Types: Grid (By default), Gallery, Form View and Kanban View
  • ⚡  View Permissions Types: Collaborative Views, & Locked Views
  • ⚡  Share Bases / Views: either Public or Private (with Password Protected)
  • ⚡  Variant Cell Types: ID, LinkToAnotherRecord, Lookup, Rollup, SingleLineText, Attachment, Currency, Formula, etc
  • ⚡  Access Control with Roles: Fine-grained Access Control at different levels
  • ⚡  and more ...

App Store for Workflow Automations

We provide different integrations in three main categories. See App Store for details.

  • ⚡  Chat: Slack, Discord, Mattermost, and etc
  • ⚡  Email: AWS SES, SMTP, MailerSend, and etc
  • ⚡  Storage: AWS S3, Google Cloud Storage, Minio, and etc

Programmatic Access

We provide the following ways to let users programmatically invoke actions. You can use a token (either JWT or Social Auth) to sign your requests for authorization to NocoDB.

  • ⚡  REST APIs
  • ⚡  NocoDB SDK

Sync Schema

We allow you to sync schema changes if you have made changes outside NocoDB GUI. However, it has to be noted then you will have to bring your own schema migrations for moving from one environment to another. See Sync Schema for details.

Audit

We are keeping all the user operation logs in one place. See Audit for details.

Production Setup

By default, SQLite is used for storing metadata. However, you can specify your database. The connection parameters for this database can be specified in NC_DB environment variable. Moreover, we also provide the below environment variables for configuration.

Environment variables

Please refer to the Environment variables

Development Setup

Please refer to Development Setup

Contributing

Please refer to Contribution Guide.

Why are we building this?

Most internet businesses equip themselves with either spreadsheet or a database to solve their business needs. Spreadsheets are used by Billion+ humans collaboratively every single day. However, we are way off working at similar speeds on databases which are way more powerful tools when it comes to computing. Attempts to solve this with SaaS offerings have meant horrible access controls, vendor lock-in, data lock-in, abrupt price changes & most importantly a glass ceiling on what's possible in the future.

Our Mission

Our mission is to provide the most powerful no-code interface for databases that is open source to every single internet business in the world. This would not only democratise access to a powerful computing tool but also bring forth a billion+ people who will have radical tinkering-and-building abilities on the internet.

License

This project is licensed under AGPLv3.

Contributors

Thank you for your contributions! We appreciate all the contributions from the community.

nocodb's People

Contributors

aashishagrawall avatar alexhladin avatar allcontributors[bot] avatar bcakmakoglu avatar darkphoenix2704 avatar dependabot[bot] avatar dolsem avatar dstala avatar flisowna avatar gentleghostcoder avatar github-actions[bot] avatar gitstart avatar iamnamananand996 avatar ketewan avatar khisby avatar mertmit avatar musharaf-nocodb avatar mustafapc19 avatar nith2001 avatar o1lab avatar pranavxc avatar rameshmane7218 avatar reenphygeorge avatar renovate[bot] avatar spaudanjo avatar sreehari2003 avatar starbirdtech383 avatar vijayrathore8492 avatar willnewii avatar wingkwong 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

nocodb's Issues

Error running with nginx-proxy

Hello, @o1lab,

I'm running xmysql from your container markuman/xmysql and want to use it with nginx-proxy container together.

	docker run -d \
	-e VIRTUAL_HOST=api.example.com \
        -e VIRTUAL_PORT=3000 \
	-e DATABASE_HOST=example-blog-db-mysql \
	-e DATABASE_USER=root \
	-e DATABASE_PASSWORD=fab14france \
	-e DATABASE_NAME=wordpress \
	--name xmysql --restart=always \
	--network nginx-proxy \
	markuman/xmysql

docker logs xmysql said that xmysql started fine:




          Generating REST APIs at the speed of your thought.. 

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
                                                            
          Database              :    wordpress
          Number of Tables      :    12
                                                            
          REST APIs Generated   :    228
                                                            
          Xmysql took           :    1.1 seconds
                                                            
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

But when I go to api.example.com I see 502 Bad Gateway nginx error.

nginx log of the request:

connect() failed (111: Connection refused) while connecting to upstream, client: 178.76.224.96, server: api.example.com, request: "GET / HTTP/1.1", upstream: "http://172.19.0.13:3000/", host: "api.example.com"

Strings from generated default.conf of nginx-proxy:

upstream api.example.com {
			server 172.19.0.13:3000;
}
...
server {
	server_name api.example.com;
	listen 80 ;
	access_log /var/log/nginx/access.log vhost;
	include /etc/nginx/vhost.d/default;
	location / {
		proxy_pass http://api.example.com
	}
}

Please help me find out what could be the issue.
IP address of xmysql docker container is correct.

# docker exec -it xmysql /bin/sh
/usr/src/app # node -v
v8.9.3
/usr/src/app # npm -v
5.5.1
/usr/src/app # mysql --version
/bin/sh: mysql: not found
/usr/src/app # xmysql --version
/bin/sh: xmysql: not found

Max page size is actually 99, not 100

Please provide dev environment versions of your system

node -v = v9.4.0
( xmysql requires node >= 7.6.0 )

npm -v = 5.6.0
mysql --version = mysql Ver 14.14 Distrib 5.5.60, for debian-linux-gnu (x86_64) using readline 6.3
xmysql --version = 0.0.4


http://api.xyz.com/api/invitations?_size=100 returns 20 rows (incorrect)
http://api.xyz.com/api/invitations?_size=99 returns 54 rows (correct)
(please remove domain names after issue has been reproduced on your end)

Also note that it's strange behavior that when a requested page size goes over the system limit, then it simply reverts back to the default 20. Would be better if API would throw an error code to indicate something went wrong.


Mark issue with suitable label if it is clear what this issue is.

( edit: removed domain name )

How get all records?

Hi there,

I have 2430 records in a table, and I need to get them all.
I need to loop through _p (page) or there is another way to get all records from a table?

thank a lot

How to run in daemon mode?

Please provide dev environment versions of your system

node -v
( xmysql requires node >= 7.6.0 )
v9.3.0

npm -v
5.5.1
mysql --version
mysql Ver 14.14 Distrib 5.7.20, for Linux (x86_64) using EditLine wrapper
xmysql --version
0.4.1


I start xmysql in ubuntu ssh remote client, but when I close the terminal, the xmysql process will be exit.
So I want to run xmysql in daemon mode to let xmysql always run, but I found xmysql have no "--daemon" parameter.

So, how to run in daemon mode? Thank you.

Add _version or _health route

I'd like to include a health check into the docker file. E.g.

HEALTHCHECK --interval=5s --timeout=3s \
  CMD curl --fail http://localhost:$PORT/_health || exit 1

So it would be nice to have a /_health route or something similar. The controller function should check if the connection to the mysql database is still alive. Or maybe a _version route, where xmysql responses with the connected mysql version. This can also be used for a health check.

What do you think?

Problem with JSON

Please provide dev environment versions of your system

node -v
( xmysql requires node >= 7.6.0 )

npm -v
mysql --version
xmysql --version


Provide steps to reproduce this issue
or
Provide minimum code to reproduce this issue
or
HTTP request,response,error snapshot of this issue


Mark issue with suitable label if it is clear what this issue is.

Issue when xmysql container startup is before mysql container startup

When using xmysql in a docker network(trough a docker compose), there is a chance xmysql gets spinned up before the related database container is ready.
If that happens it seems that only /tables works but actual requests trough the /api/ don't seem to work.
Only manually restarting the xmysql image seems to fix it.

I fixed it by adding a health check to the docker compose.
Like so:

xmysql-report:
image: "markuman/xmysql:0.4.2"
expose:
- "80"
entrypoint: /bin/sh
command: [ "-c", "cd /usr/src/app/ && node index.js --host DATABASE_HOST --password PASSWORD --database report --user root --apiPrefix /xmysql-report/api/ --portNumber 80 --ipAddress 0.0.0.0" ]
depends_on:
database-DATABASE:
condition: service_healthy

database-DATABASE:
image: "MYSQL-IMAGE"
expose:
- "3306"
ports:
- "33306:3306"
environment:
- "TZ=Europe/Amsterdam"
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
timeout: 5s
retries: 10

but docker documentation recommends the software (xmysql in this case) should be more flexible in this situation, so no healthcheck would be needed.

Cannot read property 'isView' of undefined

Hi All,

Here are my dev environment details.

  • node: v10.2.1
  • npm: 5.6.0
  • mysql: 8.0
  • xmysql: 0.4.5

Tried to generate the API for the a basic database with a single table with two columns. I got the following error:

Call Stack

(node:3444) [DEP0095] DeprecationWarning: timers.enroll() is deprecated. Please use setTimeout instead.
(node:3444) [DEP0096] DeprecationWarning: timers.unenroll() is deprecated. Please use clearTimeout instead.
C:\Users\ashan\AppData\Roaming\npm\node_modules\xmysql\node_modules\mysql\lib\protocol\Parser.js:80
throw err; // Rethrow non-MySQL errors
^

TypeError: Cannot read property 'isView' of undefined
at Xsql.iterateToCacheTables (C:\Users\ashan\AppData\Roaming\npm\node_modules\xmysql\lib\xsql.js:75:74)
at Query.self.pool.query [as _callback] (C:\Users\ashan\AppData\Roaming\npm\node_modules\xmysql\lib\xsql.js:46:14)
at Query.Sequence.end (C:\Users\ashan\AppData\Roaming\npm\node_modules\xmysql\node_modules\mysql\lib\protocol\sequences\Sequence.js:88:24)
at Query._handleFinalResultPacket (C:\Users\ashan\AppData\Roaming\npm\node_modules\xmysql\node_modules\mysql\lib\protocol\sequences\Query.js:139:8)
at Query.EofPacket (C:\Users\ashan\AppData\Roaming\npm\node_modules\xmysql\node_modules\mysql\lib\protocol\sequences\Query.js:123:8)
at Protocol._parsePacket (C:\Users\ashan\AppData\Roaming\npm\node_modules\xmysql\node_modules\mysql\lib\protocol\Protocol.js:279:23)
at Parser.write (C:\Users\ashan\AppData\Roaming\npm\node_modules\xmysql\node_modules\mysql\lib\protocol\Parser.js:76:12)
at Protocol.write (C:\Users\ashan\AppData\Roaming\npm\node_modules\xmysql\node_modules\mysql\lib\protocol\Protocol.js:39:16)
at Socket. (C:\Users\ashan\AppData\Roaming\npm\node_modules\xmysql\node_modules\mysql\lib\Connection.js:103:28)
at Socket.emit (events.js:182:13)


Use MySQL functions with filtering

Hello,

Can't we use functions in a GET url ?
I tried it but it doesn't give me the right results, here's an example :

localhost:3000/api/payments?_where=(start_on,lte,CURDATE())~and(IFNULL(end_on,CURDATE()),gte,CURDATE())

Here, I want to use the IFNULL function and the CURDATE function, but it returns me something different that a raw mysql query.

I'm coding a react native app, I could use a JS function to avoid using 'CURDATE()' but not IFNULL(), of make another query to check if end_on is null or not :(

Thanks !

node version : 10.7.0
npm version : 6.4.0
xmysql version : 0.4.9

Option to only generate GET API

Project looks interesting - should have a flag to only generate GET API - so it can be used internally without auth.
Thanks.

dynamic is not working

Hi team,

first of all star to your efforts <3

I am sending an post request to dynamic api, but system is not response as required as it through 404 error,
ajax code:
$(document).ready(function(){ $.ajax({ url: 'http://127.0.0.1:3000/dynamic', method: 'POST', data:{ "query": "select * from ?? limit 20", "params": ["issuedetailsv3"] }, success: function (data){ console.log(data); }, error : function (){ console.log('this is an error'); } }) });
following errors,

POST http://127.0.0.1:3000/dynamic 404 (Not Found)

POST /dynamic 404 147 - 3.395 ms

Please provide dev environment versions of your system

node -v
v9.0.0
( xmysql requires node >= 7.6.0 )

npm -v
5.5.1
mysql --version
5.7.20
xmysql --version
0.2.0


Provide steps to reproduce this issue
or
Provide minimum code to reproduce this issue
or
HTTP request,response,error snapshot of this issue


Mark issue with suitable label if it is clear what this issue is.

While joining two tables if some columns have same name then I am not able to select all column names (Only all unique column names are displaying in the output).

If I am using _fileds and trying to select columns which have the common name then also in the output only one column is displaying. Not getting the option to alias column name.
Example:
Table1 : User(id, name, email, city_id)
Table2: City(id, name)
query: /api/xjoin?_join=u.user,_lj,c.city&_on1=(u.city_id,eq,c.id)&_fields=u.id,u.name,c.id,c.name
Output:
[{
id: 1,
name : "xxx"
},{
id : 2,
name : "yyy"
}]
Expected Output:
[{
id: 1,
name : "xxx",
id: 1,
name : "city1"
},{
id : 2,
name : "yyy",
id: 2,
name : "city2"
}]

npm test is throwing error Cache init failed during database reading

Please provide dev environment versions of your system

node -v 8.4.0
( xmysql requires node >= 7.6.0 )

npm -v 5.3.0
mysql --version 2.15.0
xmysql --version


Provide steps to reproduce this issue
Cloned the project

cd xmysql
npm install
npm test
mocha tests/*.js --exit



  xmysql : tests
Cache init failed during database reading
{ Error: connect ECONNREFUSED 127.0.0.1:3306
    at Object._errnoException (util.js:1041:11)
    at _exceptionWithHostPort (util.js:1064:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1153:14)
    --------------------
    at Protocol._enqueue (/Users/shashi/openSource/xmysql/node_modules/mysql/lib/protocol/Protocol.js:145:48)
    at Protocol.handshake (/Users/shashi/openSource/xmysql/node_modules/mysql/lib/protocol/Protocol.js:52:23)
    at PoolConnection.connect (/Users/shashi/openSource/xmysql/node_modules/mysql/lib/Connection.js:130:18)
    at Pool.getConnection (/Users/shashi/openSource/xmysql/node_modules/mysql/lib/Pool.js:48:16)
    at Pool.query (/Users/shashi/openSource/xmysql/node_modules/mysql/lib/Pool.js:202:8)
    at Xsql.dbCacheInitAsync (/Users/shashi/openSource/xmysql/lib/xsql.js:36:15)
    at Xsql.init (/Users/shashi/openSource/xmysql/lib/xsql.js:26:10)
    at Xapi.init (/Users/shashi/openSource/xmysql/lib/xapi.js:37:16)
    at Context.<anonymous> (/Users/shashi/openSource/xmysql/tests/tests.js:42:9)
    at callFnAsync (/Users/shashi/openSource/xmysql/node_modules/mocha/lib/runnable.js:377:21)
    at Hook.Runnable.run (/Users/shashi/openSource/xmysql/node_modules/mocha/lib/runnable.js:324:7)
    at next (/Users/shashi/openSource/xmysql/node_modules/mocha/lib/runner.js:304:10)
    at Immediate._onImmediate (/Users/shashi/openSource/xmysql/node_modules/mocha/lib/runner.js:334:5)
    at runCallback (timers.js:781:20)
    at tryOnImmediate (timers.js:743:5)
    at processImmediate [as _immediateCallback] (timers.js:714:5)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 3306,
  fatal: true } undefined
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
                                                            
          Database              :    classicmodels
          Number of resources   :    0
                                                            
          REST APIs Generated   :    0

Error running install steps

npm install -g xmysql
xmysql -h localhost -u root -p pass -d dbname

Getting assertion I'm not understanding
/root/.nvm/v0.10.28/lib/node_modules/xmysql/bin/index.js:19
let app = express();
^^^
SyntaxError: Unexpected identifier
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3

Please provide dev environment versions of your system

node -v
( xmysql requires node >= 7.6.0 )
I have v0.10.28

npm -v
1.4.9

mysql --version
mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper

xmysql --version

xmysql --version

Checking throws error also
/root/.nvm/v0.10.28/lib/node_modules/xmysql/bin/index.js:19
let app = express();
^^^
SyntaxError: Unexpected identifier
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3


Provide steps to reproduce this issue
or
Provide minimum code to reproduce this issue
or
HTTP request,response,error snapshot of this issue


Mark issue with suitable label if it is clear what this issue is.

Wordpress xjoin

I'm trying to join two wordpress tables unsuccesfully with this xjoin query: /xjoin?_join=pl.wp_posts,_j,pr.wp_postmeta&_on1=(pl.ID,eq,pr.post_id)&_fields=pl.ID,pr.post_id
but I keep getting error 404, any hint?

This should be equal to SQL join: SELECT pl.ID, pr.post_id FROM wp_posts as pl JOIN wp_postmeta as pr ON pl.ID = pr.post_id

Listening on different IP

Good morning,

I've tried to deploy xmysql on my server but I need to listen on a specific IP and port (ie. 127.2.X.X:8100).
I found the way to specify the portNumber but is there any other parameter to specify the IP to listen on ?

Regards,
Adrien

Command always detects one table

node -v
( xmysql requires node >= 7.6.0 )
v8.11.1

npm -v
5.6.0
mysql --version
8.0.11
xmysql --version
0.4.8


When I run the command given in the README, the tool detecs one table only and generates 29 APIs, all of which are referencing a table named 'undefined', however the /tables API returns the correct database tables but their APIs are not generated.
I tried on a database of mine as well as classicmodels database that is used in the tests.


ER_NOT_SUPPORTED_AUTH_MODE

node -v: v13.6.0
npm -v: 6.14.3
mysql --version: 8.0.19
xmysql --version: [email protected]


issue steps provided:

cmd ran:
xmysql -h IP -o IP:PORT -u USERNAME -p PASSWORD -d DBNAME -n APPPORT

error response:
code: 'ER_NOT_SUPPORTED_AUTH_MODE', errno: 1251, sqlMessage: 'Client does not support authentication protocol requested by server; consider upgrading MySQL client', sqlState: '08004', fatal: true


the client of tool si mysql 5 compliance? in this case is possibile to update it to 8.0?

thanks

ER_BAD_FIELD_ERROR: Unknown column 'c.datetime_precision' in 'field list'

Dev environment versions:

$ node -v
v8.5.0
$ npm -v
5.5.1
$ mysql --version
mysql  Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64) using readline 6.2
$ xmysql --version
0.0.8

Right after installing xmysql from npm and starting it, I get the following error.
No code changes were done.

{ Error: ER_BAD_FIELD_ERROR: Unknown column 'c.datetime_precision' in 'field list'
    at Query.Sequence._packetToError (/Users/marcoferreira/.nvm/versions/node/v8.5.0/lib/node_modules/xmysql/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14)
    at Query.ErrorPacket (/Users/marcoferreira/.nvm/versions/node/v8.5.0/lib/node_modules/xmysql/node_modules/mysql/lib/protocol/sequences/Query.js:77:18)
    at Protocol._parsePacket (/Users/marcoferreira/.nvm/versions/node/v8.5.0/lib/node_modules/xmysql/node_modules/mysql/lib/protocol/Protocol.js:279:23)
    at Parser.write (/Users/marcoferreira/.nvm/versions/node/v8.5.0/lib/node_modules/xmysql/node_modules/mysql/lib/protocol/Parser.js:76:12)
    at Protocol.write (/Users/marcoferreira/.nvm/versions/node/v8.5.0/lib/node_modules/xmysql/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/Users/marcoferreira/.nvm/versions/node/v8.5.0/lib/node_modules/xmysql/node_modules/mysql/lib/Connection.js:103:28)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:266:12)
    at readableAddChunk (_stream_readable.js:253:11)
    --------------------
    at Pool.query (/Users/marcoferreira/.nvm/versions/node/v8.5.0/lib/node_modules/xmysql/node_modules/mysql/lib/Pool.js:199:23)
    at Xsql.dbCacheInitAsync (/Users/marcoferreira/.nvm/versions/node/v8.5.0/lib/node_modules/xmysql/lib/xsql.js:36:15)
    at Xsql.init (/Users/marcoferreira/.nvm/versions/node/v8.5.0/lib/node_modules/xmysql/lib/xsql.js:26:10)
    at Xapi.init (/Users/marcoferreira/.nvm/versions/node/v8.5.0/lib/node_modules/xmysql/lib/xapi.js:36:16)
    at Object.<anonymous> (/Users/marcoferreira/.nvm/versions/node/v8.5.0/lib/node_modules/xmysql/bin/index.js:34:10)
    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)
  code: 'ER_BAD_FIELD_ERROR',
  errno: 1054,
  sqlMessage: 'Unknown column \'c.datetime_precision\' in \'field list\'',
  sqlState: '42S22',
  index: 0,
  sql: 'select c.table_name, c.column_name, c.ordinal_position,c.column_key,c.is_nullable, c.data_type, c.column_type,c.extra,c.privileges, c.column_comment,c.column_default,c.data_type,c.character_maximum_length, c.character_octet_length,c.numeric_precision,c.numeric_scale,c.datetime_precision,c.character_set_name, c.collation_name, k.constraint_name, k.referenced_table_name, k.referenced_column_name, s.index_name,s.seq_in_index from information_schema.columns as c left join information_schema.key_column_usage as k on c.column_name=k.column_name and c.table_schema = k.referenced_table_schema and c.table_name = k.table_name left join information_schema.statistics as s on c.column_name = s.column_name and c.table_schema = s.index_schema and c.table_name = s.table_name where c.table_schema=\'gdi\' order by c.table_name, c.ordinal_position' } undefined

SQL Syntax error when posting

Good morning,

When I try to make a POST request on my Customer table to insert a row it doesn't work.
I got a SQL syntax error :

"error": {
"code": "ER_PARSE_ERROR",
"errno": 1064,
"sqlMessage": "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1",
"sqlState": "42000",
"index": 0,
"sql": "INSERT INTO customer SET "
}

Did somebody already had this issue ?

POST urls give a 404 error

Hi, thanks for this!

The api urls produced (as shown on curl localhost:34054) are all GET, no POST's, no PUT, DELETE, etc.

node -v: 10.15.2
( xmysql requires node >= 7.6.0 )

npm -v: 5.8.0
mysql --version: mysql Ver 15.1 Distrib 10.3.22-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
xmysql --version:undefined


Provide steps to reproduce this issue
$ curl --request POST --data '{"username":"xyz","password":"xyz"}' https://www.example.com/shop/customers

$ tail -f mysql_rest_api.log

      Database              :    shop
      Number of Tables      :    8
                                                        
      REST APIs Generated   :    108
                                                        
      Xmysql took           :    0.1 seconds
      API's base URL        :    localhost:34054

POST /api/customers 404 153 - 3.015 ms


Mark issue with suitable label if it is clear what this issue is.

Unexpected identifier

I have this error on my command line:
cattura
What's the problem? The database exist and the username and password of mysql are correct.

if my port != 3306,how to connect mysql

Please provide dev environment versions of your system

node -v
( xmysql requires node >= 7.6.0 )

npm -v
mysql --version
xmysql --version


Provide steps to reproduce this issue
or
Provide minimum code to reproduce this issue
or
HTTP request,response,error snapshot of this issue


Mark issue with suitable label if it is clear what this issue is.

Provide docker-compose setup

First of all, this is a great project!

Adding a docker-compose script has the following benefits:

  • No longer requires users to have certain (versions of) packages installed (e.g. npm and node)
  • Create a deterministic development/test environment
  • Replace the manual steps currently needed for testing with a single command

Would you be interested in this? I've been working on this in a fork, I can create a PR if you think this will benefit your project.

Add support for CORS headers

Please provide dev environment versions of your system

node -v: v9.2.0
( xmysql requires node >= 7.6.0 )

npm -v: 5.5.1
mysql --version: 5.7
xmysql --version: 0.4.0 (bug is also confirmed with version 0.0.2, the version I initially discovered this in)


Provide steps to reproduce this issue
0. Start xmysql on any database

  1. Open your browser console
  2. Request a page from xmysql (example: await fetch('http://localhost:3000/'))
  3. Observe the request failing because of missing cors headers

Mark issue with suitable label if it is clear what this issue is.
Can't do this as only project members and higher have access to this feature, but I would mark this as "feature", "blocker"

Generate API documentation

It would be good if it can automatically generate some API documentation using swagger specification (swagger.json) or API Blueprint (*.apib) or Postman (*.postman_collection.json)

Feature : Support Kanban view

  • Meta DB Migration Script
    • two new columns in nc_kanban_view_v2
      • grp_column_id: grouping field column id (used in stackedBy)
      • meta: meta data like stack order, colors, option titles etc.
  • stackedBy in Toolbar
    • dropdown for selecting a Single Select column
    • rerendering kanban view based on the change
  • Kanban View
    • Basic View Operations
      • Create View
      • Copy View
      • Rename View
      • Delete View
    • Stack
      • Create a new Stack
      • Re-order Stack
      • Add records within a Stack
        • Preset grouping field value
      • Drag-and-drop record cards to other Stack
      • Scroll to fetch records
      • Dropdown
        • Add new record
        • Collapse Stack
        • Delete Stack
    • Record Card
      • Click to expand form to edit
      • Drag-and-drop records across stacks
    • Share View
    • Misc
      • Sync grouping field options from other views (e.g. remove options in grid view)
    • Cypress

Resource value showing as undefined

node -v
v8.0.0

npm -v
5.0.0
mysql --version
8.0.12
xmysql --version
0.4.8


I ran the xmysql command xmysql -h localhost -u root -p password -d my_db and then went to http://localhost:3000/:

{
"resource": "undefined",
"routes": [
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined/describe"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined/count"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined/groupby"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined/distinct"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined/ugroupby"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined/chart"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined/aggregate"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined/findOne"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined/autoChart"
},
{
"httpType": "post",
"routeUrl": "http://localhost:3000/api/undefined"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined"
},
{
"httpType": "post",
"routeUrl": "http://localhost:3000/api/undefined/bulk"
},
{
"httpType": "delete",
"routeUrl": "http://localhost:3000/api/undefined/bulk"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined/bulk"
},
{
"httpType": "put",
"routeUrl": "http://localhost:3000/api/undefined"
},
{
"httpType": "patch",
"routeUrl": "http://localhost:3000/api/undefined/:id"
},
{
"httpType": "delete",
"routeUrl": "http://localhost:3000/api/undefined/:id"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined/:id"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/undefined/:id/exists"
},
{
"httpType": "get",
"routeUrl": "http://localhost:3000/api/questions/:id/undefined"
}
]
},
"http://localhost:3000/api/tables",
"http://localhost:3000/api/xjoin",
"http://localhost:3000/api/dynamic",
"/upload",
"/uploads",
"/download"
]

Help: Initial configuration: my port is not 3306. It's 31106.

Please provide dev environment versions of your system

node -v
( xmysql requires node >= 7.6.0 )

npm -v
mysql --version
xmysql --version


Provide steps to reproduce this issue
or
Provide minimum code to reproduce this issue
or
HTTP request,response,error snapshot of this issue


Mark issue with suitable label if it is clear what this issue is.
How to connect mysql by port: 31106?
Thanks.
xmysql -h localhost -u mysqlUsername -p mysqlPassword -d databaseName

Getting xmysql to work on AWS lambda

I was able to get xmysql to work on AWS lambda. This is just some docs on the process to help others.

Typescript code for index.ts:

import * as bodyParser from 'body-parser';
import * as express from 'express';

const serverless = require('serverless-http');
import * as cors from 'cors';
import { APIGatewayEvent, Context } from 'aws-lambda';
import * as config from './util/env-config';
import { NextFunction, Request, Response } from 'express';
import { AutoBeheerderError } from './util/autobeheerder-error';

const mysql = require('mysql');
const Xapi = require('./node_modules/xmysql/lib/xapi.js');
const morgan = require('morgan');

const app = express();
let onXapiInitialized = new Promise<void>((resolve, reject) => {
  try {

    // /**************** START : setup express ****************/
    app.use(morgan('tiny'));
    app.use(cors());
    app.use(bodyParser.json());
    app.use(bodyParser.urlencoded({
      extended: true
    }));
    // /**************** END : setup express ****************/

    app.use((req: Request, res: Response, next: NextFunction) => {
      // You can add authentication here
      console.log('got request for: ' + req.url, req);
      next();
    });

    let mysqlConfig = {
      host: config.envConfig.mysql.host,
      port: 3306,
      database: config.envConfig.mysql.database,
      user: config.envConfig.mysql.user,
      password: config.envConfig.mysql.password,
      apiPrefix: '/',
      ipAddress: 'localhost',
      portNumber: 3000,
      ignoreTables: [],
      storageFolder: __dirname
    };

    let mysqlPool = mysql.createPool(mysqlConfig);

    let xapi = new Xapi(mysqlConfig, mysqlPool, app);

    xapi.init(async (err: any, results: any) => {
      app.listen(3000);
      resolve();
    });

  } catch (err) {
    reject(err);
  }
});

export function handler(event: APIGatewayEvent, context: Context, callback: Function) {
  onXapiInitialized.then(() => {
    serverless(app)(event, context, callback);
  });
}

AWS setup notes:

  • The deploy uses serverless: https://serverless.com/framework/docs/getting-started/
  • The lambda function is accessed through API Gateway and access the RDS (mysql) database
    ** Make sure you deploy your API Gateway setup otherwise it won't be accessible.
  • The security setup:
    ** You need to put your lambda in a VPC
    ** The lambda role needs access to the VPC
    ** The RDS server has to be inside the VPC as well

Performance:

  • Requests to the API Gateway resolve in ~ 90ms

Running on pm2

Any instruction on how to run this on pm2 or daemon? Tried all kind of node_args for pm2 to no avail. Thanks!

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.