Download the PHP package neighborhoods/snowflake-sql-api-component without Composer

On this page you can find all versions of the php package neighborhoods/snowflake-sql-api-component. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package snowflake-sql-api-component

Snowflake SQL API Component

Latest Version on Packagist Total Downloads

A Client Component for Snowflake SQL API.

Install

Via Composer

Usage

This package offers two ways for interacting with the Snowflake SQL API.

Both implementations use the same Authentication, which is an essential part of Client V1.

Single Statement Client V1

The Snowflake SQL API has many useful features which includes.

While these features are important, in practice the following is encountered:

When the above is true, the Single Statement Client V1 can be used. Single Statement Client V1 uses Client V1 under the hood, taking care of building the appropriate API request(s) and error handling.

Execute a statement

The execute() method returns all the rows from all the pages. Each row is an associative array. The keys in the row are the column names, while the values are the cell value.

The code above results in the output below. There is only one row returned.

Notably all the column names are uppercased, because in Snowflake unquoted column names default to uppercase and are treated as case-insensitive.

Binding variables

It is possible to pass an array of binding variables as second argument to the execute() method.

The code above results in the output below.

Execute Paginated

For common select queries the volume of the results isn't that big. The execute() method combines the data from all the pages, if multiple.

If the statement is expected to produce many pages of data raising concerns on memory consumptions the executePaginated() method can be used instead.

The code above results in the output below.

Queries taking too long

If the execution of the statement takes too long, the results won't be returned right away, in which case the statement is canceled and an OngoingException is raised.

DI Paths

To build a DI container providing a SingleStatementClientV1\ClientInterface, the following paths are needed

Passing JwtTokenGenerator

The SingleStatementClientV1\ClientV1Interace DI service is only missing a configured ClientV1\JwtTokenGenerator for authentication.

Client V1

The Neighborhoods\SnowflakeSqlApiComponent\ClientV1 namespace contains a low level client implementation. While it allows using all the features of the Snowflake SQL API, using it is challenging. Often the simpler Single Statement Client V1 can be used instead. More information about the Client V1 is available here.

Authentication

At the moment only key-pair authentication is supported.

Key-pair authentication is handled by the ClientV1\JwtTokenGenerator. Configure the JwtTokenGenerator by setting the Account, User and Private Key as shown below.

This can also be done by defining a Symfony DI service using environment variables.

Test script

The vendor/bin/single_statement_client_v1_connection_test script can be run to build a container providing a SingleStatementClientV1\ClientInterface instance. The test script uses DICBC, which isn't a direct dependency of this package. You might need to add it to your development environment.

The SELECT 'Hello World' query is executed to test the Snowflake connection. If the credentials are valid, the result will be printed. Run the script for more details.

Examples

Application examples are available in the Fitness project.


All versions of snowflake-sql-api-component with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
ext-openssl Version *
php Version ^7.3|^8
guzzlehttp/guzzle Version ^6|^7
neighborhoods/throwable-diagnostic-component Version ^4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package neighborhoods/snowflake-sql-api-component contains the following files

Loading the files please wait ...