I Need to get magento sales_flat_order table all the record as a CSV.If i try to create a magento script and write into CSV file, it will take much time to write into CSV. For that will use below command to fetch the record.
Some time we want to generate all the record from the sales_flat_order table values.(for ex i took this table).When i want to fetch the collection by magento if the record is less, than time may took very less. But if the record much more, than using of magento collection
is took too much of time also it may give, memory limit issue. For resolving this kind of issue will use mysql from putty command. It will take very less time to fetch the records.
Query :
Add your mysql from with below commands as like below. Thats it, you will get CSV output.
mysql -u USERNAME -p’PASSWORD’ DATABASENAME -h HOSTNAME -e”select * from sales_flat_order” | sed ‘s/\t/”,”/g;s/^/”/;s/$/”/;s/\n//g’ > mytablevalues.csv
USERNAME : Mysql Username
PASSWORD : Mysql Password
DATABASENAME : Name of Database
HOSTNAME : Name of host
mytablevalues.csv : Output file name.
Out put file will be generate, where we running above command path. (Ex: root folder)
—————————————————————————————————————————————————————————————-
Corner of Blog:
” Save Environment “
————————————————————————————————————————————————————————————–