nocodb / nocodb Goto Github PK
View Code? Open in Web Editor NEW๐ฅ ๐ฅ ๐ฅ Open Source Airtable Alternative
Home Page: https://nocodb.com
License: GNU Affero General Public License v3.0
๐ฅ ๐ฅ ๐ฅ Open Source Airtable Alternative
Home Page: https://nocodb.com
License: GNU Affero General Public License v3.0
How can I get a random row among rows resulted in a query?
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
Hi All,
Here are my dev environment details.
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)
I need data more than 100 records, so I have to use paging but how to know it's the last page
Should I compare the numbers?
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.
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.
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)
Project looks interesting - should have a flag to only generate GET API - so it can be used internally without auth.
Thanks.
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:
Performance:
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.
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
Subject.
Where are the files installed on the server if i wanted to make changes in the API
I want to use https call my API, but xmysql default is use http
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 ?
If it possible to extend this lib to support swagger UI then it will be more easy access data.
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"
]
Any idea how to make API only for certain tables and for certain HTTP methods?
nc_kanban_view_v2
grp_column_id
: grouping field column id (used in stackedBy)meta
: meta data like stack order, colors, option titles etc.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
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
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
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
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.
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.
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.
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 )
Is there a way/guidelines how to load the lib as express middleware/consume it as a library?
Testing against a pinned and odd NodeJS release makes not much sense.
NodeJS reached its EOL some time ago.
Only even release branches are longkiving and become LTS branches.
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
The images are stretched on mobile devicss. There might be a "height" value which is problematic.
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
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
I have successfully created API, but having trouble to locate the server cause now i want to add custom functions and some custom routes
i am using MACOSX, lastest version of xmysql and nodejs v13
How to provide an ACL on how who can POST or GET and what it can GET?
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.
Any instruction on how to run this on pm2 or daemon? Tried all kind of node_args for pm2 to no avail. Thanks!
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
await fetch('http://localhost:3000/')
)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"
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"
}]
it is about 6 months ago that i wrote autorest4db which is similar to xmysql
in automatically generating RESTful api for databases. But it's only 3 stars i have gotten. how did you own so many stars in such a short time ? awesome !
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.
Hi
Is it possible to have it run on something different from localhost ? IP...
Thanks
First of all, this is a great project!
Adding a docker-compose script has the following benefits:
npm
and node
)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.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.