Comments (5)
So, if implemented... this would also work with a pipe into the front...
echo "select DATA_RESC_NAME" | iquest --no-page '%s'
AND reading in from a file?
iquest --no-page '%s' < tonyfile.txt
Would we require a new flag? Or just... accept/parse stdin if there is no selectConditionString
present?
from irods_client_icommands.
I don't think you would need a new flag. If a selectConditionString
isn't provided on the command line, see if one is provided via stdin.
from irods_client_icommands.
I would prefer requiring a flag (--stdin=select
) and/or placeholder (selectConditionString == '-'
) for these reasons,
- users hitting this code accidentally will find it hangs awaiting stdin, and that can be more confusing than a timely error
- in a future expansion the format string might arrive another way, such as stdin. If absense of
selectConditionString
is interpretted as a mode switch, you're kind of... nibbling your syntactic space from both ends, so possibly ending up with more confusion later? - a related extension which could reduce the caller's associated code is
?
placeholders in theselectConditionString
, henceprintf "/COLLECTION/BOBBY\nTABLES.dat\n" | iquest --stdin=args %s "select DATA_ID where COLL_NAME = ? and DATA_NAME = ?"
- this has a security benefit: reducing the chances of attacks similar to SQL injection, by taking the responsibility for "not getting it wrong" off the caller into the code which has a test suite. 😄
- (I realise that the currently read-only
AND
-only logic doesn't leave much room for useful injection attacks, but I bet it's possible to probe other data in a series of repeated attacks)
If you're looking for features, here's an idiom I like for better performance on bulk queries,
mca@casm3-head2:~$ seq 21 | id-n-at-a-time -n5 -q -J,
'1','2','3','4','5'
'6','7','8','9','10'
'11','12','13','14','15'
'16','17','18','19','20'
'21'
mca@casm3-head2:~$ for args in $( seq 21 | id-n-at-a-time -n5 -q -J, ); do iquest %s/%s "select COLL_NAME, DATA_NAME where DATA_ID in ($args)"; done
CAT_NO_ROWS_FOUND: Nothing was found matching your query
CAT_NO_ROWS_FOUND: Nothing was found matching your query
CAT_NO_ROWS_FOUND: Nothing was found matching your query
CAT_NO_ROWS_FOUND: Nothing was found matching your query
CAT_NO_ROWS_FOUND: Nothing was found matching your query
id-n-at-a-time
is a local quick hack, and I normally run about 500 args in the group. Some databases don't like a lot of placeholder args and when last I looked, iquest
didn't document its limit.
OK, I have no files there and so I'm bumping #282... but a feature that wraps this up might be useful to others and stdin is the place to feed it.
Something like seq 21 | iquest --stdin=in-args %s/%s "select COLL_NAME, DATA_NAME where DATA_ID in (??)"
perhaps?
Or another way: if the stdin feed is JSON and the placeholders are :named
?
These are idle ponderings rather than official feature requests.
from irods_client_icommands.
What @mcast says makes sense to me. I agree that either a -
placeholder should be used for the selectConditionString
or a flag should be set. Query value placeholders would be neat too, but that should probably become an independent feature request.
from irods_client_icommands.
I like the -
as well, it removes the ambiguity and the 'nibbling'.
from irods_client_icommands.
Related Issues (20)
- Allow multiple icommands versions to be installed HOT 3
- showing metadata ID HOT 5
- better verbosity for writes
- icd not handling special characters correctly HOT 4
- ihelp does not mention iunreg HOT 1
- Install icommands on CentOS 8 (arch: x84_64) and Red Hat 8 (arch: ppc64le) HOT 1
- irepl does not processing remaining existing data objects if it processes a nonexistent one HOT 4
- usr directory error HOT 12
- build error in rocky with main branch HOT 1
- some rule file tests failing
- iquest parses queries with tabs in the where clause incorrectly. HOT 4
- iquest silent when no results HOT 4
- iput numThreads HOT 1
- iCommands 4.3.0 fails to run with PAM HOT 2
- icp cannot copy files larger than 2GB HOT 7
- irods-icommands installs without irods-runtime on CentOS 8 HOT 2
- Bash autocomplete for iCommands not working right HOT 3
- Inconsistent iinit irods_authentication_scheme setting for pam in 4.3.0 HOT 1
- Extend ils -l to show system metadata about collections
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from irods_client_icommands.