Title: Accessing sales data from woocommerce database with python
Last modified: December 16, 2020

---

# Accessing sales data from woocommerce database with python

 *  Resolved [MBWD](https://wordpress.org/support/users/mbwd/)
 * (@mbwd)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/accessing-sales-data-from-woocommerce-database-with-python/)
 * I am using a Python script to access our WordPress db and download some data 
   that I hope to use to create regular sales reports. I’m using `mysql.connector`
   to connect to the table called `wp_woocommerce_order_items`.
 * This table is giving me the name and order ID for each transaction, but it doesn’t
   include date or price. I can see that in another table called `wp_woocommerce_sessions`
   it seems to have much more info, but it looks encrypted or something, like:
 *     ```
       "cart_totals";s:367:"a:15:{s:8:"subtotal";i:0;s:12:"subtotal_tax";i:0;s:14:"shipping_total";i:0;s:12:"shipping_tax";i:0;s:14:
       ```
   
 * I don’t quite understand what I’m seeing here. What kind of data is this? Is 
   there any way to get actual values out of it?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Faccessing-sales-data-from-woocommerce-database-with-python%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  [Adam Heckler](https://wordpress.org/support/users/adamkheckler/)
 * (@adamkheckler)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/accessing-sales-data-from-woocommerce-database-with-python/#post-13798248)
 * This is what’s called serialized data. There’s a bit of an explainer on it here:
 * [https://wpengine.com/support/wordpress-serialized-data/](https://wpengine.com/support/wordpress-serialized-data/)
 * I’m not a Python dev myself, so I’m not sure what tools Python has for extracting
   or analyzing PHP serialized data, but if I had to guess, there’s something out
   there for you. Maybe this would work?
 * [https://pypi.org/project/phpserialize/](https://pypi.org/project/phpserialize/)
 * That’s about the limit of the advice we can provide here, since we can’t really
   help with custom code, but that should get you started.
 * Hope that helps! 🙂

Viewing 1 replies (of 1 total)

The topic ‘Accessing sales data from woocommerce database with python’ is closed
to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [python](https://wordpress.org/support/topic-tag/python/)

 * 1 reply
 * 2 participants
 * Last reply from: [Adam Heckler](https://wordpress.org/support/users/adamkheckler/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/accessing-sales-data-from-woocommerce-database-with-python/#post-13798248)
 * Status: resolved