GithubHelp home page GithubHelp logo

Comments (6)

mechatroner avatar mechatroner commented on May 29, 2024 1

@KaminoU I just published version 1.5.0, now you can run RBQL even for non-table files - just enter "Rainbow CSV: RBQL" command and it should work! Also updated RBQL supports named columns like a.Age or a.phone_number.
If you see any problems - please let me know.

from sublime_rainbow_csv.

mechatroner avatar mechatroner commented on May 29, 2024

Hi @KaminoU ,
In queries without ORDER BY/GROUP BY it is possible to use the following trick:
SELECT * WHERE NR == 1 or re.match('GP001189', a2)
Or something like this if you are doing string transformations:
SELECT int(a3) / 1000 if NR > 1 else a3, *
In more complex cases, I think, the only possible solution would be to use UNION as you suggested, but it is not supported (yet?)

from sublime_rainbow_csv.

KaminoU avatar KaminoU commented on May 29, 2024

The trick works well thx =)

Btw, is there a more friendly way to select on date ? for a specific year for example SELECT * WHERE NR == 1 OR re.match("\d{2}/\d{2}/2019", a55)

regex could be painful... lol

Ayway thank you for this great trick! ^^

from sublime_rainbow_csv.

KaminoU avatar KaminoU commented on May 29, 2024

@mechatroner

Sorry to bother you again, is there a way to work directly on an whole row?

We have only columns, designed by a1...a{n} but what if we want to work directly on the whole line?

The main reason I ask it is because I need to know in my input CSV file, if there is any weirds non printable characters or not SELECT count(1) WHERE re.findall('\x0D\x0A', 'full_row') for example

Thank you again for your reply

from sublime_rainbow_csv.

mechatroner avatar mechatroner commented on May 29, 2024

@KaminoU
For string parsing you can do something like this:
select * where datetime.datetime.strptime(a55, "%d/%m/%Y").year == 2019
If you are often working with the the dates in the same format you can create a UDF in the ~/.rbql_init_source.py file:

def get_year(src_str):
    return year datetime.datetime.strptime(src_str, "%d/%m/%Y").year

Regarding full_rows, I was sure that it is possible to do this, but turns out it is not, so I will have to fix this. For now you can use standalone rbql package with "monocolumn" policy:

$ pip install rbql
$ rbql-py --input /path/to/input.txt --policy monocolumn --delim ''

from sublime_rainbow_csv.

KaminoU avatar KaminoU commented on May 29, 2024

wow!!!!!!! =D

Thank you very much!!! ^^

I am eager to see the new fix for the column and union =)

from sublime_rainbow_csv.

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.