0.1.11 • Published 10 years ago

get-schema v0.1.11

Weekly downloads
33
License
-
Repository
-
Last release
10 years ago

get-schema

Get Redshift / postgres schema for a table

Install

npm install get-schema

Usage

pg        = require('pg')
conString = 'postgres://postgres:1234@localhost/postgres'
GetSchema = require('get-schema')

pg.connect(conString, function(err, client, done) {
  if(err) throw new Error(err)

  schema = new GetSchema(client) // valid client that supports 'query()'
  schema.getColumns('registered_voters', function(err, result) {
	  // results: [ "id", "timestamp", "name", "voted" ]
  })
  schema.get('registered_voters', function(err, result) {
	// results: 
	// [ { id: 'integer' },
	// { timestamp: 'timestamp' },
	// { name: 'varchar' },
	// { voted: 'boolean' }
  })
  schema.getCreateTypes('registered_voters', function(err, result) {
	// results: 
	// [ { id: 'integer' },
	// { timestamp: 'timestamp' },
	// { name: 'varchar(80)' }, // character length added
	// { voted: 'boolean' }
  })
})

License

MIT

0.1.11

10 years ago

0.1.10

10 years ago

0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago