Shopify + Steampipe
Shopify is an e-commerce platform that allows businesses to create and manage online stores.
Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.
List Shopify order details:
select id, name, email, billing_address ->> 'address1' as address, billing_address ->> 'city' as city, billing_address ->> 'country' as country, billing_address ->> 'zip' as zip_codefrom shopify_order;
+---------------+-------+-----------------------------+-----------------+---------+---------+----------+| id | name | email | address | city | country | zip_code |+---------------+-------+-----------------------------+-----------------+---------+---------+----------+| 5367225188647 | #1007 | russel.winfield@example.com | 105 Victoria St | Toronto | Canada | M5C1N7 || 5367225057575 | #1003 | russel.winfield@example.com | 105 Victoria St | Toronto | Canada | M5C1N7 || 5367225254183 | #1009 | russel.winfield@example.com | 105 Victoria St | Toronto | Canada | M5C1N7 || 5367225221415 | #1008 | russel.winfield@example.com | 105 Victoria St | Toronto | Canada | M5C1N7 |+---------------+-------+-----------------------------+-----------------+---------+---------+----------+
Documentation
Quick start
Install
Download and install the latest Shopify plugin:
steampipe plugin install shopify
Credentials
Item | Description |
---|---|
Credentials | Shopify requires a Shop name and an API token for all requests. |
Permissions | API tokens have the same permissions as the user who creates them, and if the user permissions change, the token permissions also change. |
Radius | Each connection represents a single Shopify Installation. |
Resolution | 1. Credentials explicitly set in a steampipe config file (~/.steampipe/config/shopify.spc )2. Credentials specified in environment variables, e.g., SHOPIFY_API_TOKEN , SHOPIFY_SHOP_NAME . |
Configuration
Installing the latest shopify plugin will create a config file (~/.steampipe/config/shopify.spc
) with a single connection named shopify
:
Configure your account details in ~/.steampipe/config/shopify.spc
:
connection "shopify" { plugin = "shopify"
# `api_token`: API access token to request data from the Admin API. e.g., `shpat_ab0a4zaa19c3faketoken924176b387d`. # Please see https://www.shopify.com/partners/blog/17056443-how-to-generate-a-shopify-api-token for more information. # Can also be set with the SHOPIFY_API_TOKEN environment variable. # api_token = "shpat_ab0a4zaa19c3faketoken924176b387d"
# `shop_name`: The shop_name parameter is the shop's myshopify domain, e.g. "theshop.myshopify.com", or simply "theshop". # Can also be set with the SHOPIFY_SHOP_NAME environment variable. # shop_name = "theshop"}
Alternatively, you can also use the standard Shopify environment variables to obtain credentials only if other arguments (api_token
and shop_name
) are not specified in the connection:
export SHOPIFY_API_TOKEN=shpat_ab0a4zaa19c3faketoken924176b387dexport SHOPIFY_SHOP_NAME=theshop
)
Postgres FDW
This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_postgres_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/postgres.sh)" -- shopify
The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.
To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.
CREATE EXTENSION IF NOT EXISTS steampipe_postgres_shopify;CREATE SERVER steampipe_shopify FOREIGN DATA WRAPPER steampipe_postgres_shopify OPTIONS (config '<your_config>');CREATE SCHEMA shopify;IMPORT FOREIGN SCHEMA shopify FROM SERVER steampipe_shopify INTO shopify;
SQLite Extension
This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_sqlite_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/sqlite.sh)" -- shopify
The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.
To configure the SQLite extension, load the extension module and then run the steampipe_configure_shopify
function to configure it with plugin-specific options.
$ sqlite3sqlite> .load ./steampipe_sqlite_extension_shopify.sosqlite> select steampipe_configure_shopify('<your_config>');
Export
This plugin is available as a standalone Export CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- shopify
You can pass the configuration to the command with the --config
argument:
steampipe_export_shopify --config '<your_config>' <table_name>