Project

nssql

0.0
No release in over 3 years
Low commit activity in last 3 years
Represent NetSuite tables as you want and fetch only the needed data.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.17, < 3
~> 5.0
>= 10.0
>= 0.60.0
~> 0.17.1

Runtime

~> 0.99997
 Project Readme

NSSQL

Gem Version Build Status Maintainability Test Coverage

NSSQL allows you to query directly against NetSuite through an ODBC connection. Define your tables, primary keys and columns and query away!

Installation

Add this line to your application's Gemfile:

gem 'nssql'

And then execute:

$ bundle

Or install it yourself as:

$ gem install nssql

Usage

Follow the steps below to start using NSSQL.

Settings

NSSQL::Settings.configure do |config|
  config.user     = 'USER'
  config.password = 'PASSWORD'
end

or set ENV['NETSUITE_USER'] and ENV['NETSUITE_PASSWORD']

Table

class TestTable
  include NSSQL::Table

  ns_table_name   :test_table
  ns_primary_keys :id, :line_id
  ns_column       :id
  ns_column       :line_id
  ns_column       :name, as: :display_name
end

TestTable.ns_column_names # => [:id, :line_id, :name]
TestTable.ns_aliased_column_names # => [:id, :line_id, :display_name]

Select columns

TestTable.select_ns_columns_query will generate:

SELECT
  id,line_id,name
FROM
  test_table
ORDER BY
  id

We can pass options, like TestTable.select_ns_columns_query(where: 'id > 500') and this will generate:

SELECT
  id,line_id,name
FROM
  test_table
WHERE id > 500
ORDER BY
  id

Other selects

Select to file

NSSQL.select_to_file('SELECT 1+1')

Select array

NSSQL.select_array('SELECT 1+1')

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/apoex/nssql. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Nssql project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.