Writing to a Snowflake database

Snowflake is a modern cloud based data warehousing company, see Wikipedia. Its databases can be accessed via ODBC, and a corresponding ODBC driver is available for download on their website.

Creating schema’s without specifying the widths of columns may lead to you encountering the following phrase in an AIMMS error message: Streaming value for bind variable not supported. In this article, a running example is used to:

  1. Reproduction : Illustrate how the error message is reproduced.

  2. Remedy : How the schema can be adapted to avoid this error message from recurring.


First we create a table without being explicit about the column widths:

create table "DEMO_DB"."PUBLIC" . "HowTo521" ( "NAME" VARCHAR, "AGE" INT ) ;

Looking at the table created in Swowflake’s web interface:


We observe that the created table has the following design:


The default width for VARCHAR, 16777216 is used for this table.

Using the following declarations in the AIMMS model:

 1DeclarationSection HowTo521 {
 2    Set s_names {
 3        Index: i_name;
 4        Definition: data { jane, joe, jill };
 5    }
 6    Parameter p_age {
 7        IndexDomain: i_name;
 8        Definition: data { jane : 22, joe : 63, jill : 19 };
 9    }
10    DatabaseTable db_unknownPeopleWithAge {
11        DataSource: sp_connectionString;
12        TableName: "HowTo521";
13        Owner: "PUBLIC";
14        Mapping: {
15            "NAME" -->i_name,
16            "AGE"   -->p_age
17        }
18    }

And running the following procedure:

Procedure pr_writeHT521 {
    Body: {
        write to table db_unknownPeopleWithAge ;

We encounter the following error message:

``Error writing to database table "db_unknownPeopleWithAge": ODBC[21] : HY000 [Snowflake][Snowflake] (21)``
``Streaming value for bind variable not supported: 2``.

Thusfar the reproduction of the error message. Let’s continue with a potential remedy.


The remedy chosen here is to explicitly specify the width of the column “NAME”.

At the time of writing this article, changing the column width seemed only possible by first dropping the column and then recreating it with an explicit width as follows.

First drop the column name:

alter table "DEMO_DB"."PUBLIC" . "HowTo521" drop column "NAME"  ;

Then create it with a specific width:

alter table "DEMO_DB"."PUBLIC" . "HowTo521" add column "NAME" VARCHAR(128) ;

Checking the design of the altered table:


Viewing the data after executing the AIMMS procedure pr_writeHT521 again:


We see that the remedy worked; specifying a specific width turned out to be sufficient. The default of used by Snowflake of 16777216 turns out to be too much.