All Projects → AppGeo → cartodb

AppGeo / cartodb

Licence: MIT License
carto sql lib for node

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to cartodb

govote-api
Simple Node.js API to help people find locations to get PVCs and Vote in the upcoming Nigeria General Elections.
Stars: ✭ 15 (-11.76%)
Mutual labels:  knex
knex-tiny-logger
Zero config queries logger for knex
Stars: ✭ 24 (+41.18%)
Mutual labels:  knex
kurier
TypeScript framework to create JSON:API compliant APIs
Stars: ✭ 30 (+76.47%)
Mutual labels:  knex
kex
ORM-less for Knex
Stars: ✭ 17 (+0%)
Mutual labels:  knex
typescript-api-starter
🔰 Starter for Node.js express API in Typescript 🚀
Stars: ✭ 72 (+323.53%)
Mutual labels:  knex
carto-workshop
CARTO training materials
Stars: ✭ 81 (+376.47%)
Mutual labels:  carto
back-boilerplate
A boilerplate for building RESTful APIs using Node.js, PostgreSQL, koa, knex, bookshelf.
Stars: ✭ 33 (+94.12%)
Mutual labels:  knex
feathers-objection
Feathers database adapter for Objection.js, an ORM based on KnexJS SQL query builder for Postgres, Redshift, MSSQL, MySQL, MariaDB, SQLite3, and Oracle. Forked from feathers-knex.
Stars: ✭ 89 (+423.53%)
Mutual labels:  knex
wily
Build Node.js APIs from the command line (Dead Project 😵)
Stars: ✭ 14 (-17.65%)
Mutual labels:  knex
bookshelf-json-columns
Parse JSON columns with Bookshelf.js
Stars: ✭ 64 (+276.47%)
Mutual labels:  knex
BotBlock.org
BotBlock - The List of Discord Bot Lists and Services
Stars: ✭ 29 (+70.59%)
Mutual labels:  knex
typescript-orm-benchmark
⚖️ ORM benchmarking for Node.js applications written in TypeScript
Stars: ✭ 106 (+523.53%)
Mutual labels:  knex
vsql
A sql query builder for V
Stars: ✭ 35 (+105.88%)
Mutual labels:  knex
basemaps
A lightweight package for accessing basemaps from open sources in R 🗺️
Stars: ✭ 39 (+129.41%)
Mutual labels:  carto
carto-react
CARTO for React packages
Stars: ✭ 17 (+0%)
Mutual labels:  carto
zola-api
Zola’s API.
Stars: ✭ 23 (+35.29%)
Mutual labels:  knex
bikeways4everybody
Crowdsourcing bike routes in Boston. Making pretty maps from it.
Stars: ✭ 30 (+76.47%)
Mutual labels:  carto
carto-react-template
CARTO for React. The best way to develop Location Intelligence (LI) Apps usign CARTO platform and React
Stars: ✭ 24 (+41.18%)
Mutual labels:  carto
carto-spatial-extension
A set of UDFs and Procedures to extend BigQuery, Snowflake, Redshift and Postgres with Spatial Analytics capabilities
Stars: ✭ 131 (+670.59%)
Mutual labels:  carto
thinkorm
A flexible, lightweight and powerful Object-Relational Mapper for Node.js. Support TypeScript!!
Stars: ✭ 33 (+94.12%)
Mutual labels:  knex

cartodb tools

npm install cartodb-tools --save

some tools for working with cartodb, for now works only with api keys.

API is shamelessly copied from KNEX as is much of the code, see the documentation over their for details, currently does not support table creation.

One difference is that geojson geometries are treated as such and converted to geometries appropriate to the the_geom field in cartodb.

var cartodb = require('cartodb-tools')('username', 'api-key');

cartodb('myTable')
  .select('foo')
  .where('bar', 'baz')
  .then(function (resp) {
    //use resp
  })
  .catch(function (err) {
    // something bad happened
  });

Write Stream

var cartodb = require('cartodb-tools')('username', 'api-key')
cartodb.createWriteStream('table_name', opts);
// available options are `create` to create a new table

the query object has a few cartodb specific methods

batch

the batch method will use the carto batch api method for doing the query, since this will never return results don't use it for selects, though you can if you want it's just kinda pointless

cartodb('myTable')
  .update({
    foo: 'bar'
  })
  .where('bar', 'baz')
  .batch()
  .then(function (resp) {
    //use resp
  })

you can also use the .onSuccess or .onError method to run those queries if the first one failed or succeeded

cartodb('myTable')
  .update({
    foo: 'bar'
  })
  .where('fake collumn', 'baz')
  .batch()
  .onSuccess(cartodb('errors_log').insert({
    error_message: 'NONE!',
    date: cartodb.raw('CURRENT_TIMESTAMP')
  }))
  .onError('INSERT INTO errors_log (job_id, error_message, date) VALUES (\'<%= job_id %>\', \'<%= error_message %>\', NOW())')
  .then(function (resp) {
    //use resp
  })

By default raw queries are wrapped in a transaction, use .noTransaction() to avoid this, useful for queries that can't be in transactions

cartodb.raw('VACUUM ANALYZE').noTransaction().batch().then(function () {
  console.log('yay!');
}).catch(function () {
  console.log('no!');
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].