Difference between revisions of "Shop Import / Export Scripts"

From GLMWiki
Jump to: navigation, search
(Coffman Case Knives - old shop export into csv)
 
Line 2: Line 2:
  
 
== Coffman Case Knives - old shop export into csv ==
 
== Coffman Case Knives - old shop export into csv ==
psql -U nobody -d coffmancaseknives -h ds4 -c "copy (select p.prod_id as \"Product ID\", p.prod_name as \"Product Name\", regexp_replace(p.prod_desc, E'\^M|\r|\n', '<br>', 'g') as \"Product Description\", regexp_replace(i.item_desc, E'\^M|\r|\n', '<br>', 'g') as \"Line-Item Name\", i.item_price as \"Line-Item Price\", 'http://www.coffmancaseknives.com/shop/shop_images/original/' || p.prod_img as \"Product Image\" from product p LEFT OUTER JOIN item i on (p.prod_id = i.prod_id) ORDER BY p.prod_id ASC) to STDOUT csv header" > ~/coffmancaseknives-products.csv
+
psql -U nobody -d coffmancaseknives -h ds4 -c "copy (select p.prod_id as \"Product ID\", p.prod_name as \"Product Name\", regexp_replace(p.prod_desc, E'\^M|\r|\n', 'br', 'g') as \"Product Description\", regexp_replace(i.item_desc, E'\^M|\r|\n', 'br', 'g') as \"Line-Item Name\", i.item_price as \"Line-Item Price\", 'http://www.coffmancaseknives.com/shop/shop_images/original/' || p.prod_img as \"Product Image\" from product p LEFT OUTER JOIN item i on (p.prod_id = i.prod_id) ORDER BY p.prod_id ASC) to STDOUT csv header" > ~/coffmancaseknives-products.csv
 +
 
 +
(replace 'br' above with the appropriate html break tags)

Latest revision as of 15:37, 20 April 2016


Coffman Case Knives - old shop export into csv

psql -U nobody -d coffmancaseknives -h ds4 -c "copy (select p.prod_id as \"Product ID\", p.prod_name as \"Product Name\", regexp_replace(p.prod_desc, E'\^M|\r|\n', 'br', 'g') as \"Product Description\", regexp_replace(i.item_desc, E'\^M|\r|\n', 'br', 'g') as \"Line-Item Name\", i.item_price as \"Line-Item Price\", 'http://www.coffmancaseknives.com/shop/shop_images/original/' || p.prod_img as \"Product Image\" from product p LEFT OUTER JOIN item i on (p.prod_id = i.prod_id) ORDER BY p.prod_id ASC) to STDOUT csv header" > ~/coffmancaseknives-products.csv

(replace 'br' above with the appropriate html break tags)