Choose certain columns in mysqldump?

Choose certain columns in mysqldump?

am 29.10.2009 18:09:52 von Brian Dunning

Sorry if this is a n00b question, I did read the docs for mysqldump
before posting, but couldn't figure it out.

I'm successfully doing a mysqldump, but I want only a few of the
columns, and want them in a different order. Is this possible without
substantially slowing it down? The table has about 5 million records.

Currently I'm doing this:
mysqldump -uxxxt -pxxx -t -T/var/www/folder db_name table_name --
fields-enclosed-by=\" --fields-terminated-by=,


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Choose certain columns in mysqldump?

am 29.10.2009 18:24:39 von Michael Dykman

mysqldump is not really a data manipulation tool.. as the name
implies, it is a dumper.

What you are trying to accomlish can be done rather elegantly via the
SELECT .. INTO OUTFILE syntax

http://dev.mysql.com/doc/refman/5.1/en/select.html

and then loaded into your new structure via LOAD INFILE

http://dev.mysql.com/doc/refman/5.1/en/load-data.html


- michael dykman


On Thu, Oct 29, 2009 at 1:09 PM, Brian Dunning wro=
te:
> Sorry if this is a n00b question, I did read the docs for mysqldump befor=
e
> posting, but couldn't figure it out.
>
> I'm successfully doing a mysqldump, but I want only a few of the columns,
> and want them in a different order. Is this possible without substantiall=
y
> slowing it down? The table has about 5 million records.
>
> Currently I'm doing this:
> mysqldump -uxxxt -pxxx -t -T/var/www/folder db_name table_name
> --fields-enclosed-by=3D\" --fields-terminated-by=3D,
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: =A0 =A0http://lists.mysql.com/mysql?unsub=3Dmdykman@gmail=
..com
>
>



--=20
- michael dykman
- mdykman@gmail.com

"May you live every day of your life."
Jonathan Swift

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: Choose certain columns in mysqldump?

am 29.10.2009 18:31:08 von Jaime Crespo

2009/10/29 Michael Dykman :
> mysqldump is not really a data manipulation tool.. as the name
> implies, it is a dumper.
>
> What you are trying to accomlish can be done rather elegantly via the
> SELECT .. INTO OUTFILE syntax
>
>                    http=
://dev.mysql.com/doc/refman/5.1/en/select.html
>
> and then loaded into your new structure via LOAD INFILE
>
>                    http=
://dev.mysql.com/doc/refman/5.1/en/load-data.html

Yes, in fact, you can still do it from the command line with mysql
command line client:

mysql -urxxxt -pxxx db_name -e "SELECT [any, column, you, want] INTO
OUTFILE '/var/www/folder/table_name.txt' FROM table_name WHERE [any,
filter, you, want] ORDER BY [any, order, you, want]"


--=20
Jaime Crespo
MySQL & Java Instructor
Warp Networks


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: Choose certain columns in mysqldump?

am 29.10.2009 18:39:27 von walter harms

Jaime Crespo Rincón schrieb:
> 2009/10/29 Michael Dykman :
>> mysqldump is not really a data manipulation tool.. as the name
>> implies, it is a dumper.
>>
>> What you are trying to accomlish can be done rather elegantly via the
>> SELECT .. INTO OUTFILE syntax
>>
>> http://dev.mysql.com/doc/refman/5.1/en/select.html
>>
>> and then loaded into your new structure via LOAD INFILE
>>
>> http://dev.mysql.com/doc/refman/5.1/en/load-data.html
>
> Yes, in fact, you can still do it from the command line with mysql
> command line client:
>
> mysql -urxxxt -pxxx db_name -e "SELECT [any, column, you, want] INTO
> OUTFILE '/var/www/folder/table_name.txt' FROM table_name WHERE [any,
> filter, you, want] ORDER BY [any, order, you, want]"
>
>
I prefer mysql -BAN ....
It has the advantage that you do not need to fiddle with headers etc.

re,
wh




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Choose certain columns in mysqldump?

am 04.11.2009 02:01:22 von Brian Dunning

select into outfile was the ticket. Thanks!


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org