Closed (duplicate)
Project:
Drush
Component:
SQL
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Anonymous (not verified)
Created:
11 Aug 2010 at 15:17 UTC
Updated:
6 Mar 2019 at 15:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Anonymous (not verified) commentedJust to clarify: I am running these commands from the root directory of my drupal site. Also /home/jack/file.sql contains 1 line:
select * from permission;This is just to test if it is working...
I'm sure I'm just doing something wrong, but I could find a surprisingly small amount of information on how to use this command.
Comment #2
Anonymous (not verified) commentedJust found a workaround: drush sql-query "`cat /home/jack/file.sql`"
Comment #3
greg.1.anderson commented@jackocnr: This workaround is better:
`drush sql-connect` < /home/jack/file.sqlNote the backticks.
@moshe: We should consider supporting sqlq from a file; the workaround in #2 will fail if file.sql gets too large, and the sql-connect workaround is a little obscure. Perhaps adding --file= as an option to sqlq would be better?
Comment #4
moshe weitzman commented@greg - i agree with adding --file option.
i think we should fix the docs for sqlq in 6--3 as well. They should not mention STDIN or should point folks to the sql-connect example you gave.
Comment #5
moshe weitzman commentedLets fix in HEAD first
Comment #6
greg.1.anderson commentedComment #7
moshe weitzman commentedI recently removed that STDIN sentence. I also just added
'`drush sql-connect` < example.sql' => 'Import sql statements from a file into the current database.'to sql-query help. It already is in sql-connect help.Retitle to reflect feature request.
Comment #8
greg.1.anderson commentedThe documentation change was the important part; thanks. I might still add --file, or might put it off, depending on available time.
Comment #9
kenorb commentedComment #10
kotnik commentedHere's a --file argument support for sql-query. I need this as well.
Comment #11
kotnik commentedA small help typo slipped. Fixed now.
Comment #12
greg.1.anderson commentedSeems like the
file_get_contentsshould be indrush_sql_queryinstead of_drush_sql_query. Is there any use-case where that code needs to be in the later function?Comment #13
kotnik commentedActually, there isn't any use-case I can remember.
If that's undesired, I'll move it up, and provide patch.
Comment #14
kotnik commentedGreg, here's the patch as you've suggested.
Comment #15
kotnik commentedComment #16
greg.1.anderson commentedCode looks good -- I'm just backlogged on a bunch of short testing and cleanup tasks. I'll try to commit this soon; no objection if another maintainer wants to put it in.
Comment #17
greg.1.anderson commentedI should have committed this. Now being tracked at #1219850: sqlq removes all curly braces from sql, including those that are in the text values..