Thanks a lot Brian. I will try using this solution in one of my tests. I generally do a lot of joins over multiple tables, so concatenating those fields will be interesting. Thanks again... On Wed, May 19, 2010 at 1:49 PM, Brian Evans <grknight@scent-team.com>wrote:
On 5/19/2010 1:42 PM, Cool Guy wrote:
Oh yeah, I noticed CSV. Is pipe delimited possible too? If yes, this would solve the problem.
Sure, just change the comma to a pipe if that's what you desire. Again, it was only an example and any literal string is possible with CONCAT. The format is up to *your* imagination and preparation. Just don't forget to escape any double quotes as the shell might interpret that as the end of the command if you don't.
Brian
On Wed, May 19, 2010 at 1:38 PM, Brian Evans <grknight@scent-team.com>wrote:
On 5/19/2010 1:32 PM, Cool Guy wrote:
Yep, but the only problem is the inability to dump it as pipe or CSV format - in other words, we don't have any flexibility at all in the way of formatting the out file.
Thanks for the continued super quick replies!
My example dumps to CSV if you looked at it closely. The CONCAT does the format and the -Nsr gets rid of the table-like structure.
Brian
On Wed, May 19, 2010 at 1:27 PM, Brian Evans <grknight@scent-team.com>wrote:
On 5/19/2010 1:12 PM, Cool Guy wrote:
mysqldump is more like a backup tool and is used to dump the whole table/database rather than select records ...
The workaround we came up with is dump the data to a temp table and then use a python program to convert and dump the table in CSV format. Though it works, I feel it is redundant and not so efficient way of doing things.
On second thought, you CAN use the mysql -e IF you do this (as an example):
mysql -u root -p -Nsr -e "SELECT CONCAT('\"',FirstName,'\",\"',LastName,'\"') from db.users"
Change to suit.
On Wed, May 19, 2010 at 1:04 PM, Brian Evans <grknight@scent-team.com>wrote:
On 5/19/2010 12:58 PM, Cool Guy wrote:
Sorry for the confusion. We can dump the file to the server where the database is hosted but this problem revolves around 2 different servers - 1. Client, 2. Database.
So we want to dump the output to the client and MySQL has no such implementation. I explored the -e option and specifying the server name but it outputs only .txt file and there is no way of specifying CSV or pipe-delimited file.
Thank you...
This calls for mysqldump then. http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
Other 3rd party clients can do this too.
_______________________________________________ Mailing list: https://launchpad.net/~maria-discuss Post to : maria-discuss@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-discuss More help : https://help.launchpad.net/ListHelp