mechatroner / sublime_rainbow_csv Goto Github PK
View Code? Open in Web Editor NEW🌈Rainbow CSV - Sublime Text Package: Highlight columns in CSV and TSV files and run queeries in SQL-like language
License: MIT License
🌈Rainbow CSV - Sublime Text Package: Highlight columns in CSV and TSV files and run queeries in SQL-like language
License: MIT License
Hello,
It could be great to habe a way to save some requests like
SELECT a1, a2 ORDER BY parseInt(a2), parseInt(a1.split(".").join(""))
:)
Currently, multiline fields are only supported with commas and semicolons, see #20 for context.
It would be great if "Run RBQL query" could be also selected from the Command Palette, instead of the file context menu only.
I believe that this requires a Default.sublime-commands
file to be part of the package.
Thank you!
We have other software at our company that reads CSVs as 0,1,2,3 rather than 1,2,3,4
I love the extension, however, I haven't seen an option to start at 0 rather than 1. Is this possible now? If not can it be added as an option?
I can't tell you how many times I've messed up something just forgetting mentally to -1 from the pop-up.
Thanks for any consideration. :-)
Hello,
A few days ago rainbow_csv stopped working on Sublime. The package appears in the package list, but it's no longer visible in the View > Syntax list and csv files are not colored. I imagine the package was updated just before it stopped working since the last version came out in the weekend. I tried removing it and reinstalling it but no luck. Any clues on what might have happened?
I have the following versions:
Rainbow CSV v. 2.0.0
Sublime version: 3.2.2, Build 3211
Mac Catalina v.10.15.5
Thanks!
The globals
color scheme key names should be snake_case, not camelCase. i.e. lineHighlight
should be line_highlight
here: https://github.com/mechatroner/sublime_rainbow_csv/blob/master/RainbowCSV.sublime-color-scheme#L8-L19
Hello,
first of all, thank you for this FANTASTIC Sublime package, it saves me a great deal of time analysing csv files.
It worked seamless opening files with 'comma' delimiter. When we changed to 'pipe' separator it did not auto-detect it.
I have upgraded Sublime and the package to latest version.
Sublime Text v3.2
sublime_rainbow_csv v1.1.1
I have tried to change user settings with no success. "enable_rainbow_csv_autodetect": true/false. If I manually set separator in menu "Enable standard" or "Enable simple". It highlights the repeated re-open of file. But for every new csv file I have to set it manually again, and I deal with a lot of files.
Could this be somehow defined in settings, or simply changed in application code? If not, could it be fixed?
I am working with large JSON dumps and noticed that plugin doesn't work when a line has greater than 16383 characters. The whole line just shows up as a the default text color (white in my case). If I truncate the line, the coloring works again as it should.
This behavior is line-by-line, so it ends up making a striped effect because of lines that are too long being white and lines that are less than the threshold having the correct coloring scheme.
I have constantly used rainbow CSV.
Some of files I am working with are over 100 MB. Rainbow CSV just make sublime crash.
Is there a way to change the config file of Rainbow CSV, such that it will skip to interpret CSV files if it is over a size limit?
Hey there!
I would like to improve the project adding a custom delimeter setting to the project. What do you think about the idea?
(These effects were discovered using tab delimited notes, a useful but probably unintended use-case. The problems however persist to comma separated content.)
spell-chicked,not spell-chicked,spell-chicked
"a,b"c
d"a,b"
The alignment works nicely from the very limited testing I've done, but the final column is also processed for equal width with trailing spaces. This means that if one line is long enough for the final element to trigger a word wrap, every line becomes long enough to trigger a word wrap, which is both annoying and confusing as there doesn't seem to be any reason for it unless the user has whitespace shown
Hi,
I don't seem to be able to use the a.col_name
notation when making queries. The typical a1
(i.e. a
+ int) notation works.
I created this test file:
col1,col2,col3,vehicle_price,Vehicle type
test1,test2,test3,20,car
test1,test2,test3,200,plane
test1,test2,test3,2000,boat
and tried running select a.col1
but got this error:
Details:
query execution
At record 1, Details: 'RBQLRecord' object has no attribute 'col1'
I also tried running the select len(a.vehicle_price) / 10, a2 where int(a.vehicle_price) < 500 and a['Vehicle type'] in ["car", "plane", "boat"] limit 20
query from the README (here) and got a similar error (... RBQLRecord has no attribute ...
)
I'm running the latest 2.8.0 release of the package.
Thank you!
Hello,
I have CSV file like this
aaaa,bbbb,cccc
super,1234,mega
pokemon,456,awesome
But when I open the CSV in sublime text, there is not an auto highlight, which value should I put inside rainbow_csv_autodetect_dialects
to have it highlighted?
As per #38, customly defined colors cause no change.
Hi,
Thank you for the wonderful extension, I use it very frequently and adore it!
I was wondering if the extension is supposed to work on unsaved files?
I sometimes copy and paste bits of CSV into a new Sublime window, and manually set the syntax to "CSV (Rainbow)". The auto coloring works, but I cannot execute queries. Every time I do, I get the following error:
"RBQL Error. Unable to run query for this buffer"
After saving the file to a temporary location, I'm able to execute queries. Is there a way that queries could be run on unsaved files?
Thank you very much!
It would be nice to make query like:
SELECT a[2:4], a[6:8]
UPD if it possible to make query lile:
SELECT a['id':'name']
it will be great!
Hello,
I've had a monthly batch process that I've been using for about a year based on this sublime plugin which has been working great. It uses some UDFs defined in the .rbql_init_source.py file that require the uuid functions. So i've had 'import uuid' at the top of the init file working great for ages. A few weeks ago I started trying to run the process (skipped Feb this year, so I think my last successful run was with 1.5.0) and now it acts like the import uuid statement no longer works, as I get 'undefined global uuid' error when running my function within the query.
At first, I assumed it was something wonky with the sublime embedded python and started rolling back versions of ST3 to no avail. Even confirmed / recompiled the 3.3.6 pyo for the uuid class, etc.
After no luck there, I tried running the same process using VSCode and its corresponding rbql plugin, with the same result. So, I'm guessing some sort of weird conflict has come up with uuid, since I can import sys and use functions there with no problem.
I confirmed I can exec the functions from the python cli on the system level.
Steps for simple repro:
Install any recent version of ST3 and install Rainbow_CSV from package control
.rbql_init_source.py:
import uuid
import sys
def bob():
return sys.version
def joe():
return uuid.uuid4()
Open up a csv file in ST3 and run the following:
update set a1 = joe()
query execution, Error at line 1, details: global name 'uuid' is not defined
Now try this:
update set a1 = bob()
File executes and replaces with the expected embedded python version string
I'm going to downgrade to 1.5.0 and see if comes back, but figured I'd post here too in case anyone has run into this and has a quick solution I'm missing.
[updated] - downgraded the st3 package to 1.5.0 by replacing the folder under packages and now it works again.
Thanks!
The settings for the package do not appear inside Preferences -> Package Settings. I need to change the "rainbow_csv_max_file_size_bytes" setting and can't find where to. My Sublime Text is 3.1.1, Build 3176 and I'm using a portable version. Do you know what might be the issue?
Hello @mechatroner
Thank you for this great plugin, I would like to know if there is a possibility to include the header in the new temp tab with sub CSV data, result of the RQBL?
When it only contains few columns, it is still OK, but it's not always easy to read with a lot of rows/columns, without the header... ='(
Thank you in adavance for your reply
Cheers,
I have tried to append 2 RBQL but it does not us allow to do that
SELECT TOP 1 * UNION SELECT * WHERE re.match('GP001189', a2)
The first part will grab the header etc...
I followed the Package Control implementation, and restarted Sublime, but I continue to receive the following error:
The settings file "res://Packages/rainbow_csv/RainbowCSV.sublime-settings" could not be opened
What should I check?
Trying to change the colors manually inside RainbowCSV.sublime-color-scheme after setting use_custom_rainbow_colors
to true but it does not seem to have any effect, am i missing something?
It seems to me that the order of colors is somewhat random. I don't know is it a bug or by intent, but I would prefer a more predictable order. For example: red, green, blue, violet, red, green, blue, violet, red, green, blue, violet, and so on.
Also, it seems there is a bug with a comma: notice that a comma before 8, 11, 18, and 21 should be white.
Tested with Mariana default color scheme.
Rainbow coloring of csv/tsv files works fine. However, I get this error message during loading and none of the right-click accessible items, including RBQL queries, from 'Rainbow CSV' are available:
Traceback (most recent call last):
File "/opt/sublime_text/sublime_plugin.py", line 109, in reload_plugin
m = importlib.import_module(modulename)
File "./python3.3/importlib/__init__.py", line 90, in import_module
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "/opt/sublime_text/sublime_plugin.py", line 915, in load_module
exec(compile(source, source_path, 'exec'), mod.__dict__)
File "sublime_rbql in /home/username/.config/sublime-text-3/Installed Packages/rainbow_csv.sublime-package", line 10, in <module>
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "/opt/sublime_text/sublime_plugin.py", line 915, in load_module
exec(compile(source, source_path, 'exec'), mod.__dict__)
File "rbql_core.rbql in /home/username/.config/sublime-text-3/Installed Packages/rainbow_csv.sublime-package", line 52, in <module>
File "./python3.3/codecs.py", line 896, in open
NotADirectoryError: [Errno 20] Not a directory: '/home/username/.config/sublime-text-3/Installed Packages/rainbow_csv.sublime-package/rbql_core/template.js.raw'
I am using ST version 3 build 3143 and rainbow_csv v0.2.0
I tried to uninstall/reinstall but didn't help. Any suggestions how to fix this issue is really appreciated. Thanks.
Sublime maps F5 to sort. But so does this plugin, and somehow now both are happening.
.../Sublime Text 3/Packages/Default/Default (OSX).sublime-keymap
{ "keys": ["f5"], "command": "sort_lines", "args": {"case_sensitive": false} },
{ "keys": ["ctrl+f5"], "command": "sort_lines", "args": {"case_sensitive": true} },
Can you pick a different key?
East Asian languages (such as Chinese, Japanese, and Korean) usually take up the size of two English characters. If you don’t deal with it specially, when you use the ‘align’ function, you may not be able to align it. The look and feel is bad. It is recommended to optimize it.
sublime_rainbow_csv/auto_syntax.py
Line 33 in 2da337d
sublime_rainbow_csv/auto_syntax.py
Line 47 in 2da337d
Can these lines add a csv.
so that the format of the root scope
property in the generated .sublime-syntax
is text.csv.XXXX
? Then text.csv
will match all variants, and specific variants can still be targeted with text.csv.XXXX
.
I believe this would allow the package I use for sidebar icons to recognize the variants as text.csv
and apply the correct icon to them.
Some csv and tsv files do not have *.csv or *.tsv extensions, but we still want to highlight them. In order to do this we need to run a table auto-detection function when a new file is being opened (unless some syntax was already assigned to it). The same logic is used in Vim version of the plugin.
Is there any way to leave a light background when the .csv file is opened?
Can you add support for PSV (pipe-separated) too? Or is it possible to have setting where we can list custom extensions to apply rainbow color scheme?
Currently I have PSV and I want to automatic apply rainbow mode on file open.
The default user settings file (copied below) has an erroneous ,
& missing -settings
in the file name.
// Settings in here override those in "RainbowCSV.sublime",
{
}
Does this plugin support multiline within a column?
I have a csv looks like this, which col_B contains multiline content enclosed by quote:
col_A, col_B, col_C
apple,"normal text", 12.5
banana, "This is
multi-line
content", 14
watermelon,text,20
When parsed by this plugin, it shows me "This line has quoting error"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.