dinedal / textql

Execute SQL against structured text like CSV or TSV
MIT License
9.07k stars 300 forks source link

Add support for tagged filename (label:path) to specify tablename #114

Closed tai closed 5 years ago

tai commented 5 years ago

Hi, I added support for "tagged" filename, that allows you to specify table name explicitly.

This is useful when you are on bash or zsh that allows you to pass command output as anonymous file (actually, a pipe).

$ textql -sql 'select * from foo' foo:<(tail -3 /etc/group) bar:<(head -3 /etc/group)
motion:x:122:
lpadmin:x:123:
ntop:x:124:

Without this patch, you need to specify each table using file descriptor number which shell has allocated. It happens to be 63, 62, etc on my environment, but having a name for a table is much easier to use.

$ textql -sql 'select * from "63"' <(tail -3 /etc/group)
motion:x:122:
lpadmin:x:123:
ntop:x:124:

Best,

dinedal commented 5 years ago

Thank you for your contribution to TextQL, I really appreciate it!