Skip to content

Instantly share code, notes, and snippets.

@treystout
Created July 24, 2014 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save treystout/604e9c18a30c71980d3e to your computer and use it in GitHub Desktop.
Save treystout/604e9c18a30c71980d3e to your computer and use it in GitHub Desktop.
def __update_generic(something, some_id, some_val):
rows = 0
with pool.cursor() as c:
rows = c.execute("UPDATE products SET %s=%%s WHERE product_id=%%s" %
something, (some_val, some_id))
return rows
set_description = partial(__update_generic, 'description')
set_materials = partial(__update_generic, 'materials')
set_price = partial(__update_generic, 'price_usd')
set_shopify_id = partial(__update_generic, 'ext_shopify_product_id')
set_length = partial(__update_generic, 'dim_length_in')
set_width = partial(__update_generic, 'dim_width_in')
set_height = partial(__update_generic, 'dim_height_in')
set_published = partial(__update_generic, 'is_published')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment