diff --git a/.github/workflows/steampipe-anywhere.yml b/.github/workflows/steampipe-anywhere.yml new file mode 100644 index 0000000..05092d6 --- /dev/null +++ b/.github/workflows/steampipe-anywhere.yml @@ -0,0 +1,12 @@ +name: Release Steampipe Anywhere Components + +on: + push: + tags: + - 'v*' + + +jobs: + anywhere_publish_workflow: + uses: turbot/steampipe-workflows/.github/workflows/steampipe-anywhere.yml@main + secrets: inherit diff --git a/README.md b/README.md index a498745..0c01ab0 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,18 @@ from +---------------+-------+-----------------------------+-----------------+---------+---------+----------+ ``` +## Engines + +This plugin is available for the following engines: + +| Engine | Description +|---------------|------------------------------------------ +| [Steampipe](https://steampipe.io/docs) | The Steampipe CLI exposes APIs and services as a high-performance relational database, giving you the ability to write SQL-based queries to explore dynamic data. Mods extend Steampipe's capabilities with dashboards, reports, and controls built with simple HCL. The Steampipe CLI is a turnkey solution that includes its own Postgres database, plugin management, and mod support. +| [Postgres FDW](https://steampipe.io/docs/steampipe_postgres/overview) | Steampipe Postgres FDWs are native Postgres Foreign Data Wrappers that translate APIs to foreign tables. Unlike Steampipe CLI, which ships with its own Postgres server instance, the Steampipe Postgres FDWs can be installed in any supported Postgres database version. +| [SQLite Extension](https://steampipe.io/docs//steampipe_sqlite/overview) | Steampipe SQLite Extensions provide SQLite virtual tables that translate your queries into API calls, transparently fetching information from your API or service as you request it. +| [Export](https://steampipe.io/docs/steampipe_export/overview) | Steampipe Plugin Exporters provide a flexible mechanism for exporting information from cloud services and APIs. Each exporter is a stand-alone binary that allows you to extract data using Steampipe plugins without a database. +| [Turbot Pipes](https://turbot.com/pipes/docs) | Turbot Pipes is the only intelligence, automation & security platform built specifically for DevOps. Pipes provide hosted Steampipe database instances, shared dashboards, snapshots, and more. + ## Developing Prerequisites: @@ -111,11 +123,17 @@ Further reading: - [Writing plugins](https://steampipe.io/docs/develop/writing-plugins) - [Writing your first table](https://steampipe.io/docs/develop/writing-your-first-table) -## Contributing +## Open Source & Contributing + +This repository is published under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) (source code) and [CC BY-NC-ND](https://creativecommons.org/licenses/by-nc-nd/2.0/) (docs) licenses. Please see our [code of conduct](https://github.com/turbot/.github/blob/main/CODE_OF_CONDUCT.md). We look forward to collaborating with you! + +[Steampipe](https://steampipe.io) is a product produced from this open source software, exclusively by [Turbot HQ, Inc](https://turbot.com). It is distributed under our commercial terms. Others are allowed to make their own distribution of the software, but cannot use any of the Turbot trademarks, cloud services, etc. You can learn more in our [Open Source FAQ](https://turbot.com/open-source). + +## Get Involved -Please see the [contribution guidelines](https://github.com/turbot/steampipe/blob/main/CONTRIBUTING.md) and our [code of conduct](https://github.com/turbot/steampipe/blob/main/CODE_OF_CONDUCT.md). All contributions are subject to the [Apache 2.0 open source license](https://github.com/turbot/steampipe-plugin-shopify/blob/main/LICENSE). +**[Join #steampipe on Slack →](https://turbot.com/community/join)** -`help wanted` issues: +Want to help but don't know where to start? Pick up one of the `help wanted` issues: - [Steampipe](https://github.com/turbot/steampipe/labels/help%20wanted) - [Shopify Plugin](https://github.com/turbot/steampipe-plugin-shopify/labels/help%20wanted) \ No newline at end of file diff --git a/docs/LICENSE b/docs/LICENSE new file mode 100644 index 0000000..236ac28 --- /dev/null +++ b/docs/LICENSE @@ -0,0 +1,402 @@ +Attribution-NonCommercial-NoDerivatives 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 +International Public License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-NonCommercial-NoDerivatives 4.0 International Public +License ("Public License"). To the extent this Public License may be +interpreted as a contract, You are granted the Licensed Rights in +consideration of Your acceptance of these terms and conditions, and the +Licensor grants You such rights in consideration of benefits the +Licensor receives from making the Licensed Material available under +these terms and conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + c. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + d. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + e. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + f. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + g. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + h. NonCommercial means not primarily intended for or directed towards + commercial advantage or monetary compensation. For purposes of + this Public License, the exchange of the Licensed Material for + other material subject to Copyright and Similar Rights by digital + file-sharing or similar means is NonCommercial provided there is + no payment of monetary compensation in connection with the + exchange. + + i. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + j. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + k. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part, for NonCommercial purposes only; and + + b. produce and reproduce, but not Share, Adapted Material + for NonCommercial purposes only. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties, including when + the Licensed Material is used other than for NonCommercial + purposes. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material, You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + For the avoidance of doubt, You do not have permission under + this Public License to Share Adapted Material. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database for NonCommercial purposes + only and provided You do not Share Adapted Material; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material; and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 438616b..7cb6df6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,13 +8,14 @@ short_name: "shopify" description: "Steampipe plugin to query products, order, customers and more from Shopify." og_description: "Query Shopify with SQL! Open source CLI. No DB required." og_image: "/images/plugins/turbot/shopify-social-graphic.png" +engines: ["steampipe", "sqlite", "postgres", "export"] --- # Shopify + Steampipe [Shopify](https://shopify.com/) is an e-commerce platform that allows businesses to create and manage online stores. -[Steampipe](https://steampipe.io) is an open source CLI to instantly query cloud APIs using SQL. +[Steampipe](https://steampipe.io) is an open-source zero-ETL engine to instantly query cloud APIs using SQL. List Shopify order details: @@ -93,7 +94,4 @@ export SHOPIFY_API_TOKEN=shpat_ab0a4zaa19c3faketoken924176b387d export SHOPIFY_SHOP_NAME=theshop ``` -## Get involved - -- Open source: https://github.com/turbot/steampipe-plugin-shopify -- Community: [Join #steampipe on Slack →](https://turbot.com/community/join) \ No newline at end of file +) \ No newline at end of file diff --git a/docs/tables/shopify_collection_product.md b/docs/tables/shopify_collection_product.md index a89bfe4..524aa1e 100644 --- a/docs/tables/shopify_collection_product.md +++ b/docs/tables/shopify_collection_product.md @@ -1,12 +1,34 @@ -# Table: shopify_collection_product +--- +title: "Steampipe Table: shopify_collection_product - Query Shopify Collection Products using SQL" +description: "Allows users to query Collection Products in Shopify, specifically the associated product details and collection information, providing insights into product categorization and organization." +--- -Shopify collection products are a group of related products that are curated and organized together by a store owner on the Shopify platform. +# Table: shopify_collection_product - Query Shopify Collection Products using SQL + +Shopify Collection Products represent the relationship between products and their associated collections within the Shopify platform. Collections are a way to group and organize products, making them easier to manage and find. They can be created manually, or they can be automatically generated based on conditions that you specify. + +## Table Usage Guide + +The `shopify_collection_product` table provides insights into the relationship between products and collections within Shopify. As a store manager or developer, explore product-specific details and their collection associations through this table, including collection IDs, product IDs, and position in the collection. Utilize it to uncover information about product organization, such as which products belong to which collections, and the order of products within collections. ## Examples ### Basic info +Explore which products are included in your Shopify collections, along with their vendors and status. This can help you manage and organize your products more effectively. -```sql +```sql+postgres +select + collection_id, + collection_title, + product_id, + product_title, + vendor, + status +from + shopify_collection_product; +``` + +```sql+sqlite select collection_id, collection_title, @@ -19,8 +41,23 @@ from ``` ### List all products in a specific collection by collection ID +Explore which products belong to a certain collection using a unique identifier, allowing you to assess the range and variety within that collection. This could be useful for inventory management or identifying gaps in your product offerings. -```sql +```sql+postgres +select + collection_id, + product_id, + product_title, + handle, + vendor, + status +from + shopify_collection_product +where + collection_id = 444300460327; +``` + +```sql+sqlite select collection_id, product_id, @@ -35,8 +72,24 @@ where ``` ### List all products in a specific collection by collection title +Explore which products fall under a specific collection in your Shopify store. This is particularly useful to assess the range of items within a given collection, aiding in inventory management and marketing efforts. + +```sql+postgres +select + collection_id, + product_id, + product_title, + collection_title, + handle, + vendor, + status +from + shopify_collection_product +where + collection_title = 'Jelly'; +``` -```sql +```sql+sqlite select collection_id, product_id, @@ -52,8 +105,19 @@ where ``` ### Get the total count of products in each collection +Explore which collections have the most products to better manage inventory and sales strategies. This allows for a comprehensive understanding of product distribution across different collections. -```sql +```sql+postgres +select + collection_title, + count(*) as total_count +from + shopify_collection_product +group by + collection_title; +``` + +```sql+sqlite select collection_title, count(*) as total_count @@ -64,8 +128,21 @@ group by ``` ### Get the number of products in each collection that are currently in stock +Explore which collections have products currently in stock. This query is useful for inventory management, allowing you to see the distribution of available products across different collections. -```sql +```sql+postgres +select + collection_title, + count(*) as total_count +from + shopify_collection_product +where + status = 'in_stock' +group by + collection_title; +``` + +```sql+sqlite select collection_title, count(*) as total_count @@ -78,8 +155,9 @@ group by ``` ### List all the products in a collection created in the last one month +Identify all the products added to any collection within the past month. This can assist in understanding recent inventory changes and tracking product performance. -```sql +```sql+postgres select collection_id, collection_title, @@ -92,4 +170,19 @@ from shopify_collection_product where created_at >= now() - interval '30' day; +``` + +```sql+sqlite +select + collection_id, + collection_title, + product_id, + product_title, + vendor, + status, + created_at +from + shopify_collection_product +where + created_at >= datetime('now', '-30 day'); ``` \ No newline at end of file diff --git a/docs/tables/shopify_custom_collection.md b/docs/tables/shopify_custom_collection.md index e2ee259..8c54a4e 100644 --- a/docs/tables/shopify_custom_collection.md +++ b/docs/tables/shopify_custom_collection.md @@ -1,12 +1,32 @@ -# Table: shopify_custom_collection +--- +title: "Steampipe Table: shopify_custom_collection - Query Shopify Custom Collections using SQL" +description: "Allows users to query Shopify Custom Collections, specifically the details of each custom collection, providing insights into product organization and categorization." +--- -Shopify custom collection is a group of products that a merchant can create to make their store easier to browse. +# Table: shopify_custom_collection - Query Shopify Custom Collections using SQL + +Shopify Custom Collections are a feature within Shopify that allows you to group your products into categories. These collections can be manually curated or automatically generated based on conditions you set. Custom collections are useful for organizing products by type, season, sale, and other variables that suit your store's needs. + +## Table Usage Guide + +The `shopify_custom_collection` table provides insights into custom collections within Shopify. As a store manager or developer, explore collection-specific details through this table, including the collection title, product count, and related metadata. Utilize it to uncover information about collections, such as their organization, the products they contain, and their visibility status. ## Examples ### Basic info +Explore the basic details of your custom collections on Shopify, such as their unique identifiers, titles, handles, and the scope in which they are published. This can help you better manage and organize your collections. + +```sql+postgres +select + id, + title, + handle, + published_scope +from + shopify_custom_collection; +``` -```sql +```sql+sqlite select id, title, @@ -17,8 +37,16 @@ from ``` ### Get the total number of custom collections +Discover the total number of custom collections in your Shopify store. This can be useful for managing inventory and understanding the diversity of your product offerings. + +```sql+postgres +select + count(*) as total_custom_collections +from + shopify_custom_collection; +``` -```sql +```sql+sqlite select count(*) as total_custom_collections from @@ -26,8 +54,9 @@ from ``` ### Retrieve all published custom collections +Discover the segments that are part of all the published custom collections. This is useful in understanding which collections are available for public viewing, aiding in inventory management and marketing strategies. -```sql +```sql+postgres select id, title, @@ -39,9 +68,34 @@ where published = true; ``` +```sql+sqlite +select + id, + title, + handle, + published +from + shopify_custom_collection +where + published = 1; +``` + ### Retrieve the custom collection details with a specific ID +Explore the specific details of a custom collection in your Shopify store using its unique ID. This is particularly useful to quickly assess the status and properties of a collection without having to manually search for it. + +```sql+postgres +select + id, + title, + handle, + published +from + shopify_custom_collection +where + id = 444300460327; +``` -```sql +```sql+sqlite select id, title, @@ -54,8 +108,21 @@ where ``` ### Retrieve the custom collection with a specific handle +Explore which custom collections are associated with a specific handle in Shopify to assess their publication status. This can be particularly useful for managing and organizing your collections efficiently. + +```sql+postgres +select + id, + title, + handle, + published +from + shopify_custom_collection +where + handle = 'jelly'; +``` -```sql +```sql+sqlite select id, title, @@ -68,8 +135,22 @@ where ``` ### Retrieve all custom collections updated after a specific date +Explore which custom collections have been updated after a certain date. This is particularly useful for keeping track of recent changes to your collections on Shopify. -```sql +```sql+postgres +select + id, + title, + handle, + published, + updated_at +from + shopify_custom_collection +where + updated_at > '2023-01-01'; +``` + +```sql+sqlite select id, title, @@ -83,8 +164,9 @@ where ``` ### Retrieve the number of custom collections published in a specific month +Discover the volume of custom collections made public within a specific month. This could be useful for understanding publishing trends or assessing the effectiveness of content strategies during that period. -```sql +```sql+postgres select count(*) as custom_collection_count from @@ -94,9 +176,20 @@ where and date_trunc('month', published_at) = '2023-04-01'; ``` +```sql+sqlite +select + count(*) as custom_collection_count +from + shopify_custom_collection +where + published = 1 + and strftime('%Y-%m', published_at) = '2023-04'; +``` + ### Retrieve all custom collections that contain a specific metafield key +Discover the segments that have a particular type of metafield key in your custom collections. This can help you understand and manage the collections that share common characteristics or settings. -```sql +```sql+postgres select id, title, @@ -109,3 +202,7 @@ from where metafields @> '[{"key": "description_tag"}]'; ``` + +```sql+sqlite +Error: The corresponding SQLite query is unavailable. +``` \ No newline at end of file diff --git a/docs/tables/shopify_customer.md b/docs/tables/shopify_customer.md index 14fa1f3..925b921 100644 --- a/docs/tables/shopify_customer.md +++ b/docs/tables/shopify_customer.md @@ -1,12 +1,33 @@ -# Table: shopify_customer +--- +title: "Steampipe Table: shopify_customer - Query Shopify Customers using SQL" +description: "Allows users to query Customers in Shopify, specifically the customer details and their associated data, providing insights into customer behavior and preferences." +--- -Shopify Customer stores information about a shop's customers, such as their contact details, their order history, and whether they've agreed to receive email marketing. +# Table: shopify_customer - Query Shopify Customers using SQL + +Shopify is a commerce platform that allows anyone to set up an online store and sell their products. It is also used by merchants to sell products in person with Shopify POS. Shopify Customers are the group of people who have made an account or purchased from the Shopify store, their data includes personal information, purchase history, and interaction with the store. + +## Table Usage Guide + +The `shopify_customer` table provides insights into customers within Shopify. As a store owner or a sales analyst, explore customer-specific details through this table, including personal information, purchase history, and interaction with the store. Utilize it to uncover information about customers, such as their preferences, buying behavior, and interaction with the store. ## Examples ### Basic info +Explore customer details to understand their contact information, which can be useful for customer service or marketing purposes. This query can help identify key customer data, enhancing customer relationships and driving personalized engagement strategies. -```sql +```sql+postgres +select + id, + email, + first_name, + last_name, + phone +from + shopify_customer; +``` + +```sql+sqlite select id, email, @@ -18,8 +39,24 @@ from ``` ### Get the total number of orders placed and the total amount spent by a customer +Explore the purchasing behavior of a specific customer by determining the total number of purchases made and the overall amount spent. This can aid in understanding customer loyalty and spending habits, which is crucial for targeted marketing and sales strategies. -```sql +```sql+postgres +select + id, + email, + first_name, + last_name, + phone, + orders_count, + total_spent +from + shopify_customer +where + email = 'russel.winfield@example.com'; +``` + +```sql+sqlite select id, email, @@ -35,8 +72,23 @@ where ``` ### Get the latest order details of a customer +Explore the most recent order made by a specific customer to gain insights into their purchase history and preferences. This can aid in personalizing their shopping experience and improving customer retention strategies. + +```sql+postgres +select + id, + email, + first_name, + last_name, + last_order_id, + last_order_name +from + shopify_customer +where + email = 'russel.winfield@example.com'; +``` -```sql +```sql+sqlite select id, email, @@ -51,8 +103,23 @@ where ``` ### Get the details of the customer who spent the most +Discover the customer who has made the highest total purchases. This can be useful for identifying your most valuable customer for targeted marketing or reward programs. -```sql +```sql+postgres +select + id, + email, + phone, + first_name, + last_name, + total_spent +from + shopify_customer +where + total_spent = (select max(total_spent) from shopify_customer); +``` + +```sql+sqlite select id, email, @@ -67,8 +134,9 @@ where ``` ### Get the default address of a customer +Discover the default address linked to a specific customer's email. This is useful for verifying the primary location tied to a customer's account. -```sql +```sql+postgres select id, email, @@ -79,9 +147,21 @@ where email = 'russel.winfield@example.com'; ``` +```sql+sqlite +select + id, + email, + default_address +from + shopify_customer +where + email = 'russel.winfield@example.com'; +``` + ### Get all the addresses for a customer +Discover the segments that contain all the addresses associated with a specific customer's email. This can be useful for businesses looking to understand customer location distribution or for customer service purposes. -```sql +```sql+postgres select id, email, @@ -92,9 +172,21 @@ where email = 'russel.winfield@example.com'; ``` +```sql+sqlite +select + id, + email, + addresses +from + shopify_customer +where + email = 'russel.winfield@example.com'; +``` + ### List customers with unverified emails +Pinpoint the specific customers who have yet to verify their email addresses. This is beneficial for sending reminders or follow-ups to increase the rate of verified customers. -```sql +```sql+postgres select id, email, @@ -106,9 +198,36 @@ where not verified_email; ``` +```sql+sqlite +select + id, + email, + phone, + verified_email +from + shopify_customer +where + verified_email = 0; +``` + ### List customers who opted-in for email marketing. +Explore which customers have chosen to receive email marketing, allowing for targeted communication and promotional strategies. This can aid in understanding customer preferences and enhancing marketing efforts. -```sql +```sql+postgres +select + id, + email, + phone, + first_name, + last_name, + accepts_marketing +from + shopify_customer +where + accepts_marketing; +``` + +```sql+sqlite select id, email, @@ -123,8 +242,9 @@ where ``` ### List tax exempted customers +Discover the segments of customers who have been granted tax exemption. This can be useful for understanding the demographics of customers who may be more likely to make purchases due to their tax exempt status. -```sql +```sql+postgres select id, email, @@ -138,9 +258,38 @@ where tax_exempt; ``` +```sql+sqlite +select + id, + email, + first_name, + last_name, + phone, + tax_exempt +from + shopify_customer +where + tax_exempt = 1; +``` + ### List disabled customers +Explore which customers have been disabled in your Shopify store. This can be useful for understanding customer engagement, identifying potential issues or errors, and maintaining accurate customer records. -```sql +```sql+postgres +select + id, + email, + first_name, + last_name, + phone, + state +from + shopify_customer +where + state = 'disabled'; +``` + +```sql+sqlite select id, email, @@ -155,8 +304,9 @@ where ``` ### List customers created within the last 30 days +Discover the segments that have newly joined your customer base in the past month. This can help in tailoring new marketing strategies or promotional offers to engage them effectively. -```sql +```sql+postgres select id, email, @@ -171,3 +321,19 @@ where order by created_at; ``` + +```sql+sqlite +select + id, + email, + first_name, + last_name, + phone, + created_at +from + shopify_customer +where + created_at >= datetime('now', '-30 day') +order by + created_at; +``` \ No newline at end of file diff --git a/docs/tables/shopify_draft_order.md b/docs/tables/shopify_draft_order.md index bc13eb6..a4b0659 100644 --- a/docs/tables/shopify_draft_order.md +++ b/docs/tables/shopify_draft_order.md @@ -1,12 +1,34 @@ -# Table : shopify_draft_order +--- +title: "Steampipe Table: shopify_draft_order - Query Shopify Draft Orders using SQL" +description: "Allows users to query Draft Orders in Shopify, specifically providing detailed information about the orders that are in draft status, which can aid in understanding order patterns and potential discrepancies." +--- -A draft order is an order a merchant makes in the Shopify admin on behalf of a customer. +# Table: shopify_draft_order - Query Shopify Draft Orders using SQL + +A Draft Order in Shopify is a customizable order that allows merchants to create items and orders for customers that can be modified before purchase. It provides a way to create orders for customers that can be customized and updated before they are finalized. Draft Orders are used for orders that are not placed through the usual online checkout process, such as orders taken over the phone or for custom products. + +## Table Usage Guide + +The `shopify_draft_order` table provides detailed insights into Draft Orders within Shopify. As an e-commerce manager or data analyst, explore draft order-specific details through this table, including customer information, line items, and associated metadata. Utilize it to uncover information about draft orders, such as those that have been pending for a long time, the common products in draft orders, and the verification of customer details. ## Examples ### Basic info +Explore which draft orders exist in your Shopify store, including customer details and shipping information. This can help you understand your pending transactions and plan your inventory and shipping strategies accordingly. -```sql +```sql+postgres +select + id, + name, + email, + customer, + billing_address, + shipping_address +from + shopify_draft_order; +``` + +```sql+sqlite select id, name, @@ -19,8 +41,9 @@ from ``` ### List all draft orders that have a status of "open" and include taxes in the product price +Determine the open draft orders which have incorporated taxes into the product pricing. This is particularly useful for financial analysis and tax auditing purposes. -```sql +```sql+postgres select id, name, @@ -37,9 +60,44 @@ where and taxes_included = true; ``` +```sql+sqlite +select + id, + name, + email, + customer, + billing_address, + shipping_address, + status, + taxes_included +from + shopify_draft_order +where + status = 'open' + and taxes_included = 1; +``` + ### Find all draft orders with a specific tag +Discover the segments that contain draft orders tagged with discounts. This is beneficial for identifying potential sales opportunities or for tracking promotional campaigns. -```sql +```sql+postgres +select + id, + name, + email, + customer, + billing_address, + shipping_address, + status, + tags, + taxes_included +from + shopify_draft_order +where + tags like '%Discount%'; +``` + +```sql+sqlite select id, name, @@ -57,8 +115,9 @@ where ``` ### Find all draft orders that contain a specific product in their line items +Discover the segments that contain a specific product in their draft orders, allowing you to analyze customer purchase behavior and product popularity. This information can be used to tailor marketing strategies and optimize inventory management. -```sql +```sql+postgres select id, name, @@ -75,9 +134,27 @@ where li ->> 'product_id' = '8264171716903'; ``` +```sql+sqlite +select + id, + name, + email, + customer, + json_extract(li.value, '$.name') as product_name, + json_extract(li.value, '$.price') as product_price, + json_extract(li.value, '$.product_id') as product_id, + billing_address +from + shopify_draft_order, + json_each(line_items) as li +where + json_extract(li.value, '$.product_id') = '8264171716903'; +``` + ### List all the draft orders from a particular city +Discover the segments that contain draft orders from a particular city. This is useful for businesses that want to analyze their order patterns geographically, specifically focusing on areas with pending transactions. -```sql +```sql+postgres select id, name, @@ -89,9 +166,22 @@ where shipping_address ->> 'city' = 'Toronto'; ``` +```sql+sqlite +select + id, + name, + email, + shipping_address +from + shopify_draft_order +where + json_extract(shipping_address, '$.city') = 'Toronto'; +``` + ### List all draft orders for a particular customer +Explore all pending orders associated with a specific customer to keep track of their purchase history and manage their orders effectively. This can be particularly useful for businesses seeking to enhance their customer service and ensure timely order processing. -```sql +```sql+postgres select id, name, @@ -106,9 +196,25 @@ where and customer ->> 'last_name' = 'Ruby'; ``` +```sql+sqlite +select + id, + name, + email, + customer, + billing_address, + shipping_address +from + shopify_draft_order +where + json_extract(customer, '$.first_name') = 'Karine' + and json_extract(customer, '$.last_name') = 'Ruby'; +``` + ### List the draft orders that have total tax greater than 100 +Determine the areas in which draft orders have a tax amount exceeding 100. This can be useful for identifying potential high-value transactions or regions with higher tax rates. -```sql +```sql+postgres select id, name, @@ -121,4 +227,19 @@ from shopify_draft_order where (total_tax)::numeric > 100; +``` + +```sql+sqlite +select + id, + name, + email, + customer, + billing_address, + shipping_address, + total_tax +from + shopify_draft_order +where + CAST(total_tax AS REAL) > 100; ``` \ No newline at end of file diff --git a/docs/tables/shopify_order.md b/docs/tables/shopify_order.md index dcd3d52..2fbeaaf 100644 --- a/docs/tables/shopify_order.md +++ b/docs/tables/shopify_order.md @@ -1,12 +1,34 @@ -# Table: shopify_order +--- +title: "Steampipe Table: shopify_order - Query Shopify Orders using SQL" +description: "Allows users to query Orders from Shopify, specifically the order details, providing insights into sales performance, customer purchasing habits, and inventory management." +--- -Shopify Orders record all the orders that customers have made in the Shopify store. +# Table: shopify_order - Query Shopify Orders using SQL + +Shopify is a widely-used, e-commerce platform that allows businesses to set up an online store and sell their products. It provides an array of features such as product inventory management, order management, and customer relationship management. An Order in Shopify is a record of a sale made through your store, it contains information about the products, customer details, and shipping. + +## Table Usage Guide + +The `shopify_order` table provides insights into orders made within a Shopify store. As a store manager or a business analyst, explore order-specific details through this table, including customer information, product details, and shipping details. Utilize it to analyze sales performance, understand customer purchasing habits, and manage inventory effectively. ## Examples ### Basic info +Discover the segments that include customer details and their associated shipping and billing addresses. This can help to gain insights into customer location data for potential marketing strategies or logistical planning. + +```sql+postgres +select + id, + name, + email, + customer, + billing_address, + shipping_address +from + shopify_order; +``` -```sql +```sql+sqlite select id, name, @@ -19,8 +41,9 @@ from ``` ### List all fulfilled orders shipped to a specific postal code +Discover the segments that have successfully completed orders delivered to a specific area. This can be useful in understanding customer distribution and analyzing sales performance in targeted locations. -```sql +```sql+postgres select id, name, @@ -34,9 +57,24 @@ where and shipping_address ->> 'zip' = '712136'; ``` +```sql+sqlite +select + id, + name, + email, + json_extract(shipping_address, '$.zip') as zip_code, + fulfillment_status +from + shopify_order +where + fulfillment_status = 'fulfilled' + and json_extract(shipping_address, '$.zip') = '712136'; +``` + ### List the total price of each order where at least one item has a price greater than $100 +Assess the total costs of orders containing items priced over $100 to gain insights into high-value transactions. This can aid in identifying potential revenue streams and understanding customer purchasing habits. -```sql +```sql+postgres select id, name, @@ -49,9 +87,23 @@ where (item->>'price')::numeric > 100; ``` +```sql+sqlite +select + id, + name, + email, + total_price +from + shopify_order, + json_each(line_items) as item +where + CAST(json_extract(item.value, '$.price') AS REAL) > 100; +``` + ### List number of items in each order +Analyze the settings to understand the quantity of products in each customer order. This is useful for inventory management and understanding customer purchasing behavior. -```sql +```sql+postgres select id, name, @@ -61,9 +113,20 @@ from shopify_order; ``` +```sql+sqlite +select + id, + name, + email, + json_array_length(line_items) as number_of_items +from + shopify_order; +``` + ### List all orders where the customer's email belong to the domain "gmail.com" +Explore which orders were made by customers using a Gmail account. This is useful for understanding customer demographics and tailoring marketing efforts towards specific email service users. -```sql +```sql+postgres select id, name, @@ -75,9 +138,22 @@ where customer->>'email' like '%@gmail.com'; ``` +```sql+sqlite +select + id, + name, + email, + (json_extract(customer, '$.first_name') || ' ' || json_extract(customer, '$.last_name')) as customer_name +from + shopify_order +where + json_extract(customer, '$.email') like '%@gmail.com'; +``` + ### List the orders cancelled within last 30 days +Discover the instances of order cancellations in the past month. This helps in analyzing the reasons for cancellation and aids in making informed decisions to reduce such instances in the future. -```sql +```sql+postgres select id, name, @@ -92,9 +168,37 @@ order by cancelled_at; ``` +```sql+sqlite +select + id, + name, + email, + cancel_reason, + cancelled_at +from + shopify_order +where + cancelled_at >= datetime('now', '-30 day') +order by + cancelled_at; +``` + ### List pending or partially paid orders +Determine the status of your online store's orders to identify those that are pending or partially paid. This could be useful for tracking incomplete transactions and improving your revenue collection process. -```sql +```sql+postgres +select + id, + name, + email, + financial_status +from + shopify_order +where + financial_status in ('pending','partially_paid'); +``` + +```sql+sqlite select id, name, @@ -107,8 +211,9 @@ where ``` ### Get the order details of refunded orders +Explore which orders have been refunded, including the status of each refund and the total amount refunded. This can be useful for gaining insights into refund patterns and tracking customer satisfaction. -```sql +```sql+postgres select id, name, @@ -121,9 +226,23 @@ from jsonb_array_elements(refunds) as refund; ``` +```sql+sqlite +select + shop.id, + shop.name, + shop.email, + json_extract(ref.value, '$.status') as refund_status, + json_extract(ref.value, '$.amount') as refund_amount, + coalesce(json_array_length(json_extract(shop.refunds, '$.refund_line_items')),0) as number_of_products_refunded +from + shopify_order shop, + json_each(shop.refunds) as ref; +``` + ### Get the orders processed on a particular date +Discover the segments that had their orders processed on a specific date. This is useful for tracking business performance and customer activity on a day-to-day basis. -```sql +```sql+postgres select id, name, @@ -136,9 +255,37 @@ where processed_at::date = '2023-04-25'; ``` +```sql+sqlite +select + id, + name, + email, + cancel_reason, + processed_at +from + shopify_order +where + date(processed_at) = '2023-04-25'; +``` + ### List the orders which are fulfilled but receipts are not send +Identify instances where orders have been fulfilled but the corresponding receipts have not been sent. This is useful for ensuring all customers receive their receipts and for maintaining accurate records. -```sql +```sql+postgres +select + id, + name, + email, + fulfillment_status, + send_fulfillment_receipt +from + shopify_order +where + fulfillment_status = 'fulfilled' + and not send_fulfillment_receipt; +``` + +```sql+sqlite select id, name, @@ -153,8 +300,18 @@ where ``` ### Count number of orders paid manually +Explore the volume of orders that have been manually paid for. This can help in identifying the extent of manual interventions in the payment process and potentially streamline operations. -```sql +```sql+postgres +select + count(*) as orders_paid_manually +from + shopify_order +where + gateway = 'manual'; +``` + +```sql+sqlite select count(*) as orders_paid_manually from @@ -164,8 +321,9 @@ where ``` ### Get the tax details of the products ordered +Determine the tax details associated with each product order to understand the different tax types and rates applied. This can help in analyzing the tax structure for various products, facilitating better financial planning and management. -```sql +```sql+postgres select id as order_id, name as order_name, @@ -180,9 +338,38 @@ from jsonb_array_elements(line_items) as item; ``` +```sql+sqlite +select + id as order_id, + name as order_name, + email, + json_extract(item.value, '$.product_id') as product_id, + json_extract(item.value, '$.price') as product_price, + json_extract(tax.value, '$.rate') as tax_rate, + json_extract(tax.value, '$.title') as tax_type, + json_extract(tax.value, '$.price') as tax_price +from + shopify_order, + json_each(line_items) as item, + json_each(json_extract(item.value, '$.tax_lines')) as tax; +``` + ### List the orders with discounts +Discover the segments that have been granted discounts on their orders. This is useful for analyzing the effectiveness of discount strategies and identifying popular discount trends among customers. -```sql +```sql+postgres +select + id, + name, + email, + total_discounts +from + shopify_order +where + total_discounts > 0; +``` + +```sql+sqlite select id, name, @@ -195,8 +382,9 @@ where ``` ### Get the most ordered product of the last month +Determine the most popular product sold in the last month to identify customer preferences and guide inventory decisions. This query is useful for businesses seeking to optimize their product offering based on recent sales trends. -```sql +```sql+postgres select p.id, p.title, @@ -223,4 +411,33 @@ from order_date limit 1 ) as q on p.id = q.id::bigint; +``` + +```sql+sqlite +select + p.id, + p.title, + p.product_type, + p.created_at, + p.vendor, + q.c as sales_count +from + shopify_product as p + join ( + select + json_extract(item.value, '$.product_id') as id, + count(*) as c, + min(created_at) AS order_date + from + shopify_order, + json_each(line_items) as item + where + created_at >= date('now', '-30 day') + group by + json_extract(item.value, '$.product_id') + order by + c desc, + order_date + limit 1 + ) as q on p.id = q.id; ``` \ No newline at end of file diff --git a/docs/tables/shopify_product.md b/docs/tables/shopify_product.md index dc01d10..df141bf 100644 --- a/docs/tables/shopify_product.md +++ b/docs/tables/shopify_product.md @@ -1,12 +1,33 @@ -# Table: shopify_product +--- +title: "Steampipe Table: shopify_product - Query Shopify Products using SQL" +description: "Allows users to query Products in Shopify, specifically the product details, providing insights into product inventory, price, and other related information." +--- -Shopify Products are the goods, digital downloads, services, and gift cards that are sold in Shopify. +# Table: shopify_product - Query Shopify Products using SQL + +Shopify is an e-commerce platform that allows businesses to create online stores and sell their products. It provides a variety of tools for managing products, inventory, payments, and shipping. Shopify's Product resource represents individual items that a store's customers can purchase. + +## Table Usage Guide + +The `shopify_product` table provides insights into products within Shopify. As a store manager or business analyst, explore product-specific details through this table, including pricing, inventory, and associated metadata. Utilize it to uncover information about products, such as their availability status, variant details, and the verification of product details. ## Examples ### Basic info +Explore the basic attributes of your Shopify products such as their ID, title, type, creation date, and vendor. This query is beneficial in providing a quick overview of your product catalog. -```sql +```sql+postgres +select + id, + title, + product_type, + created_at, + vendor +from + shopify_product; +``` + +```sql+sqlite select id, title, @@ -18,8 +39,19 @@ from ``` ### Count how many items of a specific type are there +Explore the variety of items in your Shopify store by assessing the total count of each product type. This can aid in inventory management and understanding your product diversity. -```sql +```sql+postgres +select + product_type, + count(*) as product_count +from + shopify_product +group by + product_type; +``` + +```sql+sqlite select product_type, count(*) as product_count @@ -30,8 +62,20 @@ group by ``` ### List products with a specific tag +Explore which products in your Shopify store are labeled as 'Premium'. This can help you identify your high-end offerings and analyze their performance. -```sql +```sql+postgres +select + id, + title, + created_at +from + shopify_product +where + tags like '%Premium%'; +``` + +```sql+sqlite select id, title, @@ -43,8 +87,9 @@ where ``` ### List products created within the last 30 days +Explore which products have been added to your Shopify store in the past month. This is useful for tracking inventory updates and identifying recent additions to your product catalog. -```sql +```sql+postgres select id, title, @@ -57,9 +102,34 @@ order by created_at; ``` +```sql+sqlite +select + id, + title, + created_at +from + shopify_product +where + created_at >= datetime('now', '-30 day') +order by + created_at; +``` + ### List archived products +Discover the segments that contain archived products in your Shopify store. This is beneficial for assessing inventory management and identifying products that are no longer active. -```sql +```sql+postgres +select + id, + title, + created_at +from + shopify_product +where + status = 'archived'; +``` + +```sql+sqlite select id, title, @@ -71,8 +141,22 @@ where ``` ### List the product variants with quantities less than 20 +Discover the segments that have product variants with low stock levels. This can help businesses to plan for restocking and prevent potential sales losses due to unavailability of popular products. -```sql +```sql+postgres +select + p.id as product_id, + p.title as product_title, + v.inventory_item_id as variant_inventory_item_id, + v.inventory_quantity as variant_inventory_quantity +from + shopify_product as p, + shopify_product_variant as v +where + v.inventory_quantity < 20; +``` + +```sql+sqlite select p.id as product_id, p.title as product_title, @@ -86,8 +170,22 @@ where ``` ### List the product variants which require shipping +Explore which product variants require shipping, helping you to plan logistics and shipping costs more effectively. Similarly, determine the product variants that are taxable, providing crucial information for accurate financial planning and tax compliance. + +```sql+postgres +select + p.id as product_id, + p.title as product_title, + v.inventory_item_id as variant_inventory_item_id, + v.requires_shipping as requires_shipping +from + shopify_product as p, + shopify_product_variant as v +where + v.requires_shipping; +``` -```sql +```sql+sqlite select p.id as product_id, p.title as product_title, @@ -102,7 +200,21 @@ where ## List the product variants which are taxable -```sql +```sql+postgres +select + p.id as product_id, + p.title as product_title, + v.inventory_item_id as variant_inventory_item_id, + v.taxable as taxable, + v.tax_code as tax_code +from + shopify_product as p, + shopify_product_variant as v +where + v.taxable; +``` + +```sql+sqlite select p.id as product_id, p.title as product_title, @@ -117,8 +229,9 @@ where ``` ### Get the best selling product of the last month +Determine the top-selling product over the past month for strategic business insights. This aids in understanding consumer behavior, product performance, and can guide inventory management and marketing efforts. -```sql +```sql+postgres select p.id, p.title, @@ -145,4 +258,33 @@ from order_date limit 1 ) as q on p.id = q.id::bigint; +``` + +```sql+sqlite +select + p.id, + p.title, + p.product_type, + p.created_at, + p.vendor, + q.c as sales_count +from + shopify_product as p + join ( + select + json_extract(item.value, '$.product_id') as id, + count(*) as c, + min(created_at) AS order_date + from + shopify_order, + json_each(line_items) as item + where + date(created_at) >= date(julianday('now') - 30) + group by + json_extract(item.value, '$.product_id') + order by + c desc, + order_date + limit 1 + ) as q on p.id = q.id; ``` \ No newline at end of file diff --git a/docs/tables/shopify_product_variant.md b/docs/tables/shopify_product_variant.md index b82b8d1..dacd0c8 100644 --- a/docs/tables/shopify_product_variant.md +++ b/docs/tables/shopify_product_variant.md @@ -1,12 +1,32 @@ -# Table: shopify_product_variant +--- +title: "Steampipe Table: shopify_product_variant - Query Shopify Product Variants using SQL" +description: "Allows users to query Shopify Product Variants, providing detailed information on different versions of products available in a Shopify store." +--- -Shopify Products Variant can be added to a Product resource to represent one version of a product with several options. The Product resource will have a variant for every possible combination of its options. +# Table: shopify_product_variant - Query Shopify Product Variants using SQL + +A Shopify Product Variant represents different versions of a product in a Shopify store. These versions can differ in many aspects, such as size, color, material, or other attributes. They are crucial in providing customers with a variety of options and increasing the diversity of product offerings in a Shopify store. + +## Table Usage Guide + +The `shopify_product_variant` table provides insights into the product variants within a Shopify store. As a store manager or data analyst, you can explore variant-specific details through this table, including price, SKU, and inventory quantities. Utilize it to uncover information about product diversity, pricing strategies, and inventory management in your Shopify store. ## Examples ### Basic info +Explore which product variants are available in your Shopify store, helping you to assess inventory and manage product listings effectively. + +```sql+postgres +select + id, + product_id, + title, + inventory_item_id +from + shopify_product_variant; +``` -```sql +```sql+sqlite select id, product_id, @@ -17,8 +37,9 @@ from ``` ### Retrieve all products where the weight is greater than 5.5 pounds +Explore which product variants in your Shopify store weigh more than 5.5 pounds. This can be useful for determining shipping costs or identifying heavy items in your inventory. -```sql +```sql+postgres select id, product_id, @@ -33,9 +54,25 @@ where and weight_unit = 'lb'; ``` +```sql+sqlite +select + id, + product_id, + title, + weight, + weight_unit, + inventory_item_id +from + shopify_product_variant +where + cast(weight as decimal) > 5.5 + and weight_unit = 'lb'; +``` + ### Retrieve all products that have a price less than $50 and are not taxable +Explore which products are priced under $50 and are exempt from taxation. This can be beneficial for customers seeking affordable and tax-free options. -```sql +```sql+postgres select id, product_id, @@ -50,9 +87,38 @@ where and not taxable; ``` +```sql+sqlite +select + id, + product_id, + title, + weight, + weight_unit, + inventory_item_id +from + shopify_product_variant +where + CAST(price AS REAL) < 50 + and not taxable; +``` + ### Retrieve all products that have inventory management enabled and have less than 10 items in stock +Explore which products are running low on stock and have inventory management enabled. This query can help you proactively manage inventory and prevent product shortages. -```sql +```sql+postgres +select + id, + product_id, + title, + inventory_item_id +from + shopify_product_variant +where + inventory_management is not null + and inventory_quantity < 10; +``` + +```sql+sqlite select id, product_id, @@ -66,8 +132,24 @@ where ``` ### Get the variant with the lowest price for a specific product +Discover the variant of a specific product that offers the lowest price. This can be useful in identifying the most cost-effective option for purchasing or selling a particular product. + +```sql+postgres +select + id, + product_id, + title, + inventory_item_id +from + shopify_product_variant +where + product_id = '8264171749671' +order by + price +limit 1; +``` -```sql +```sql+sqlite select id, product_id, @@ -83,8 +165,21 @@ limit 1; ``` ### Get the variants that are out of stock +Discover the variants that are currently out of stock. This is beneficial in managing inventory and understanding which products need to be restocked. -```sql +```sql+postgres +select + id, + product_id, + title, + inventory_item_id +from + shopify_product_variant +where + inventory_quantity = 0; +``` + +```sql+sqlite select id, product_id, @@ -97,8 +192,22 @@ where ``` ### Retrieve all products that have a barcode and are fulfilled by a specific service +Explore which products are fulfilled by a specific service and also have a barcode. This can be useful for tracking inventory or managing product distribution. + +```sql+postgres +select + id, + product_id, + title, + inventory_item_id +from + shopify_product_variant +where + barcode is not null + and fulfillment_service = 'my_fulfillment_service'; +``` -```sql +```sql+sqlite select id, product_id, diff --git a/docs/tables/shopify_smart_collection.md b/docs/tables/shopify_smart_collection.md index e9a45e0..4584f7d 100644 --- a/docs/tables/shopify_smart_collection.md +++ b/docs/tables/shopify_smart_collection.md @@ -1,12 +1,32 @@ -# Table: shopify_smart_collection +--- +title: "Steampipe Table: shopify_smart_collection - Query Shopify Smart Collections using SQL" +description: "Allows users to query Shopify Smart Collections, specifically to retrieve the rules and metadata associated with each collection, providing insights into product categorization and organization." +--- -Shopify smart collection is a grouping of products defined by rules that are set by the merchant. Shopify automatically changes the contents of a smart collection based on the rules. Smart collections, like other types of collections, are used to break down the catalog of products into categories and make the shop easier to browse. +# Table: shopify_smart_collection - Query Shopify Smart Collections using SQL + +A Shopify Smart Collection is a feature within Shopify that allows you to create product groups based on predefined conditions. These conditions can include product title, type, price, tag, weight, and more. Smart Collections provide a dynamic way to organize and display products in your Shopify store, improving product discovery and shopping experience for your customers. + +## Table Usage Guide + +The `shopify_smart_collection` table provides insights into Smart Collections within Shopify. As an e-commerce manager or developer, explore collection-specific details through this table, including the rules that define each collection and associated metadata. Utilize it to uncover information about your product organization, such as collections that include specific product types or tags, and to verify the conditions that define each collection. ## Examples ### Basic info +Explore which smart collections in your Shopify store have been updated recently. This can help you track product trends and manage your inventory more effectively. -```sql +```sql+postgres +select + id, + title, + updated_at, + handle +from + shopify_smart_collection; +``` + +```sql+sqlite select id, title, @@ -17,8 +37,9 @@ from ``` ### Get the number of rules for each smart collection +Explore the number of rules applied to each smart collection in your Shopify account, allowing you to assess the complexity of your collection filtering system. This can help streamline your product management by identifying collections with an excessive or minimal number of rules. -```sql +```sql+postgres select id, title, @@ -29,9 +50,21 @@ from shopify_smart_collection; ``` +```sql+sqlite +select + id, + title, + handle, + updated_at, + json_array_length(rules) as num_rules +from + shopify_smart_collection; +``` + ### Get the total number of published smart collections +Determine the total count of smart collections that have been made publicly available. This information can be useful for assessing the volume of collections that are accessible to customers. -```sql +```sql+postgres select count(*) as published_smart_collection from @@ -40,9 +73,19 @@ where published; ``` +```sql+sqlite +select + count(*) as published_smart_collection +from + shopify_smart_collection +where + published = 1; +``` + ### Get the smart collections published with in last 30 days +Explore which smart collections were published within the last 30 days. This can help keep track of recent updates and manage your collections more effectively. -```sql +```sql+postgres select id, title, @@ -57,9 +100,25 @@ order by published_at; ``` +```sql+sqlite +select + id, + title, + handle, + updated_at, + published_at +from + shopify_smart_collection +where + published_at >= datetime('now', '-30 day') +order by + published_at; +``` + ### Get the IDs, titles, and image URLs of all custom collections that have an image +Discover the custom collections that include images, which can be useful for auditing visual content or identifying collections for promotional campaigns. -```sql +```sql+postgres select id, title, @@ -72,9 +131,23 @@ where image ->> 'src' is not null; ``` +```sql+sqlite +select + id, + title, + updated_at, + handle, + json_extract(image, '$.src') as image_url +from + shopify_smart_collection +where + json_extract(image, '$.src') is not null; +``` + ### Retrieve all smart collections that contain a specific metafield value +Discover the segments that contain a certain metafield value within all smart collections. This is particularly useful when you want to identify and analyze the collections that are associated with a specific attribute or characteristic. -```sql +```sql+postgres select id, title, @@ -88,9 +161,24 @@ where metafields @> '[{"value": "hello test 123"}]'; ``` +```sql+sqlite +select + id, + title, + handle, + published, + updated_at, + metafields +from + shopify_smart_collection +where + json_extract(metafields, '$[*].value') = 'hello test 123'; +``` + ### List all disjunctive smart collections +Explore the smart collections on your Shopify store that use the disjunctive condition, allowing for a broader product inclusion in each collection. This can be useful in understanding the diversity of your product range and how it is categorized. -```sql +```sql+postgres select id, title, @@ -100,4 +188,16 @@ from shopify_smart_collection where disjunctive; +``` + +```sql+sqlite +select + id, + title, + updated_at, + handle +from + shopify_smart_collection +where + disjunctive = 1; ``` \ No newline at end of file diff --git a/docs/tables/shopify_theme.md b/docs/tables/shopify_theme.md index b77a416..55c5cda 100644 --- a/docs/tables/shopify_theme.md +++ b/docs/tables/shopify_theme.md @@ -1,12 +1,32 @@ -# Table: shopify_theme +--- +title: "Steampipe Table: shopify_theme - Query Shopify Themes using SQL" +description: "Allows users to query Shopify Themes, specifically the active and inactive themes in a Shopify store, providing insights into the current theme setup and potential customization options." +--- -Shopify themes are pre-designed website templates that allow you to easily customize the look and feel of your online store without requiring advanced web development skills. +# Table: shopify_theme - Query Shopify Themes using SQL + +Shopify Themes are the templates that determine the look and feel of a Shopify store. They provide the framework for all the content seen by customers when they visit the online store. Themes can be customized, and Shopify stores can have multiple themes installed, but only one can be published and active at a time. + +## Table Usage Guide + +The `shopify_theme` table provides insights into the themes used within a Shopify store. As a store owner or a web developer, explore theme-specific details through this table, including theme roles, theme names, and associated metadata. Utilize it to uncover information about themes, such as the currently active theme, the previewable themes, and the customization options available for each theme. ## Examples ### Basic info +Discover the segments that include the unique identifiers, names, and roles of your Shopify themes to assess their availability for preview. This can be useful in managing and organizing your store's visual presentation. + +```sql+postgres +select + id, + name, + previewable, + role +from + shopify_theme; +``` -```sql +```sql+sqlite select id, name, @@ -17,8 +37,9 @@ from ``` ### Get the names and IDs of all themes that are previewable +Discover the themes that are previewable to understand which themes are available for preview, helping you to make informed decisions about theme selection. -```sql +```sql+postgres select id, name @@ -28,9 +49,20 @@ where previewable = true; ``` +```sql+sqlite +select + id, + name +from + shopify_theme +where + previewable = 1; +``` + ### Get the name and creation date of the oldest processing theme +Explore which theme has been processing for the longest time on your Shopify store. This can help identify potential performance issues or bottlenecks in your store's theme management. -```sql +```sql+postgres select name, created_at @@ -43,9 +75,23 @@ order by limit 1; ``` +```sql+sqlite +select + name, + created_at +from + shopify_theme +where + processing = 1 +order by + created_at asc +limit 1; +``` + ### Get the themes that were last updated within the past 30 days +Gain insights into the themes that have been updated recently. This query is particularly useful for keeping track of theme modifications and ensuring your website stays current and functional. -```sql +```sql+postgres select name, id, @@ -55,3 +101,14 @@ from where updated_at >= now() - interval '30 days'; ``` + +```sql+sqlite +select + name, + id, + updated_at +from + shopify_theme +where + updated_at >= datetime('now', '-30 days'); +``` \ No newline at end of file