Git Product home page Git Product logo

mysql2format's Introduction

mysql2format

Binaries

mysql2csv --user=dbuser --password=dbpassword --database=dbname --execute="select * from automobile_makes"
mysql2json --user=dbuser --password=dbpassword --database=dbname --execute="select * from automobile_makes"
mysql2xml --user=dbuser --password=dbpassword --database=dbname --execute="select * from automobile_makes"

To see all options

mysql2csv --help

Ruby

a = Mysql2format::JSON.new :user => 'dbuser', :password => 'dbpassword', :database => 'dbname', :execute => "select * from automobile_makes"
a.to_stdout                                     # write it directly to $stdout
puts a.to_s                                     # get a string
a.to_path('/tmp/outfile.json')                  # write it to a file at this path
a.to_file(File.open('/tmp/outfile.json', 'w'))  # write it to a file handle

Note also that if you’re running it inside a Rails application, it will default to the ActiveRecord connection config.

a = Mysql2format::JSON.new :execute => "select * from automobile_makes"  # no need to specify user, etc. because it's taken from ActiveRecord

Well-formedness

  • CSV output depends on FasterCSV to_csv

  • JSON output depends on Florian Frank’s JSON JSON.generate

  • XML output is written manually, but looks like the output of mysql [hyphen][hyphen]xml

Copyright 2011 Seamus Abshere

mysql2format's People

Contributors

seamusabshere avatar scalixte-mdsol avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.