Giter Site home page Giter Site logo

Comments (10)

dorosch avatar dorosch commented on May 4, 2024

Well, you know like this

$ records --path ~/bd/test.sql --formar csv

and is ready, the table in the desired format

from records.

dorosch avatar dorosch commented on May 4, 2024

and make exports from the file into the table

$ records export --path ~/test.csv
user: ...
password: ...
in which database: ...
table name: ...

result export: OK

from records.

kennethreitz avatar kennethreitz commented on May 4, 2024

I like this idea, very much!

from records.

kennethreitz avatar kennethreitz commented on May 4, 2024

Print results out to console:
$ records myquery.sql

Print results as JSON out to console:
$ records myquery.sql json

Add parameters (for parameterized queries):
$ records myquery.sql --params 'Python|Ruby'

Export functionality:
$ records myquery.sql csv > data.csv

from records.

dorosch avatar dorosch commented on May 4, 2024

what do you mean (language=python) ?

$ records myquery.sql language=python

from records.

kennethreitz avatar kennethreitz commented on May 4, 2024

@andrew-tifon language is a parameter to the query.

from records.

dorosch avatar dorosch commented on May 4, 2024

It's param=None ?
Database.query(query, param=None ...)

from records.

kennethreitz avatar kennethreitz commented on May 4, 2024

@andrew-tifon updated my example :)

from records.

kennethreitz avatar kennethreitz commented on May 4, 2024

Okay, I worked on this last night. Got the help string down with usage/etc.

Records: SQL for Humans™
A Kenneth Reitz project.

Usage:
  records <query> [<format>] [--url=<url>] [--params <params>...]
  records (-h | --help)

Options:
  -h --help    Show this screen.
  --url=<url>  The database URL to use. Defaults to $DATABASE_URL.
  --params     Prameterized query. Subsequent arguments are treated as
               parameters to the query.

Supported Formats:
   csv, tsv, json, yaml, html, xls, xlsx, dbf, latex, ods

   Note: xls, xlsx, dbf, and ods formats are binary, and should only be
         used with piped output e.g. '$ records sql xls > sql.xls'.

Notes:
  - While you may specify a Postgres connection string with --url, records
    will automatically default to the value of $DATABASE_URL, if available.
  - Query is intended to be the path of a SQL file, however a query string
    can be provided instead. Use this feature discernfully; it's dangerous.
  - Records is intended for report-style exports of database queries, and
    has not yet been optimized for extremely large data dumps.

Cake:
   ✨ 🍰 ✨

from records.

kennethreitz avatar kennethreitz commented on May 4, 2024

Relased!

from records.

Related Issues (20)

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.