Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Agile SQL databases and tools for database administrators

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 CHANGELOG.textile
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENCE.textile
Octocat-spinner-32 README.textile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 TODO.textile
Octocat-spinner-32 dbagile.gemspec
README.textile

DbAgile – SQL Databases with Agility

DbAgile aims at providing agile tools around databases, and relational/sql databases in particular.

Motivation

Have you ever dreamed of having one central point for keeping your database access infos?

  sh$ dba db:list
  sh$ dba db:use my_contacts

Or displaying a SQL table (say, ‘contacts’) in one shell command?

  sh$ dba sql:show contacts

Or to output the result of any SQL query to yaml, json, csv, ruby, … or even xml?

  sh$ dba bulk:export --yaml "SELECT name, mail FROM contacts" 

Or to have a Restful server on top of SQL databases?

  dba web:tools

Making similar things, … in Ruby?

  DbAgile::dba do |dba|
    # Override environment default values (~/.dbagile, STDOUT)
    dba.repository_path  = ...      # your application database repository
    dba.output_buffer     = ...     # keep output in any IO object
  
    # Start using dbagile commands
    dba.bulk_export %w{--yaml contacts}  # each line pushed in output_buffer
  end

The Rack middleware for the restful server (config.ru):

  #!/usr/bin/env rackup --require dbagile/restful/middleware -p 8711
  app = DbAgile::Restful::Middleware.new{|env|
    #
    # Set the environment!
    #
    # WARNING: Always use ::File instead of File because constants are
    #          resolved in Rack scope, which contains a File class. Not
    #          doing this may mead to bugs in certain ruby versions.
    #
    env.repository_path  = ::File.expand_path('../dbagile', __FILE__)
  }

Pointers

  • DbAgile developper documentation on rdoc.info

Installation

  gem install dbagile (required dependencies are automatically installed)
  dba --help

Required dependencies:

  • sbyc >= 0.1.4
  • sequel >= 3.8.0
  • highline >= 1.5.2

Optional dependencies (according to your needs):

  • mysql, pg, sqlite, … (according to your sql database needs)
  • json (only if you use json import/export)
  • fastercsv (only if you use csv import/export)
  • yaml (only if you use yaml import/export)
  • builder (only if you use xml export)
  • rack >= 1.1.0 (only if you use the restful server)

Credits

DbAgile © 2010 by Bernard Lambeau and the University of Louvain. DbAgile is distributed under the MIT licence. Please see the LICENCE.textile document for details.

Something went wrong with that request. Please try again.