snowflake-connector-python icon indicating copy to clipboard operation
snowflake-connector-python copied to clipboard

SNOW-171246: snowflake.connector.errors.ProgrammingError: 001003 (42000) when inserting DataFrame to Snowflake

Open maranax opened this issue 6 years ago • 1 comments

  1. What version of Python are you using (python --version)? It's 3.7

  2. What operating system and processor architecture are you using? Windows 10

  3. What are the component versions in the environment ? asn1crypto 1.3.0 azure-common 1.1.25 azure-core 1.6.0 azure-storage-blob 12.3.2 boto3 1.13.26 botocore 1.16.26 certifi 2020.6.20 cffi 1.14.0 chardet 3.0.4 cryptography 2.9.2 docutils 0.15.2 idna 2.9 isodate 0.6.0 jmespath 0.10.0 msrest 0.6.16 numpy 1.19.0 oauthlib 3.1.0 oscrypto 1.2.0 pandas 1.0.5 pip 20.1.1 pyarrow 0.17.1 pycparser 2.20 pycryptodomex 3.9.7 PyJWT 1.7.1 pyodbc 4.0.30 pyOpenSSL 19.1.0 python-dateutil 2.8.1 pytz 2020.1 requests 2.23.0 requests-oauthlib 1.3.0 s3transfer 0.3.3 setuptools 47.3.1 six 1.15.0 snowflake 0.0.3 snowflake-connector-python 2.2.8 snowflake-sqlalchemy 1.2.3 SQLAlchemy 1.3.17 urllib3 1.25.9

  4. What did you do? OK, here is the Snowflake docs how to bring a pandas DataFrame to Snowflke: https://docs.snowflake.com/en/user-guide/python-connector-api.html#label-python-connector-api-write-pandas

I'm trying to follow exact instructions. My dataframe is here:

df_t = pd.DataFrame([(1.9204, 0, 1, 46.7300, 0, 113000, 113000, '2012-03-10 13:09:06.290', '2012-03-10 13:09:06.290', 50192, 'A', 'Y', 'N', 'N', 'NNN', 2, 0, 1, '2012-03-10 19:50:58.233', '2012-03-10 19:50:59.800', '2020-02-27 15:10:07.457', '2020-02-27 15:10:07.457',168)], columns = cols) Actually, I'm trying to bring data from SQL Server->DataFrame->Snowflake. Please, don't tell me about csv files. I did it already. :-) Anyway, after using this, according to docs, I execute a function:

success, nchunks, nrows, _ = write_pandas(conn, df_t, 'Some_Table')

And I get this error:

snowflake.connector.errors.ProgrammingError: 001003 (42000): SQL compilation error: syntax error line 1 at position 87 unexpected '~'. parse error line 1 at position 98 near '76'. parse error line 1 at position 104 near '84'. parse error line 1 at position 109 near '116'. parse error line 1 at position 121 near '102'. syntax error line 1 at position 126 unexpected '.'. syntax error line 1 at position 131 unexpected '@"swjrp"'

Some posts (lost the link) said that it's a connector problem, but it was going to be fixed in version 1.23. So, it's version 3, I believe. Is that a bug or my curly brains?

Table DDL:

CREATE TABLE "Some_Table" ( ID decimal(14, 7) NULL, ID2 int NULL, Amt float NULL, Amt2 float NULL, Item decimal(14, 7) NULL, Column6 int NULL, Column7 int NULL, CreatedDate datetime NULL, UpdatedDate datetime NULL, Column10 int NULL, Status char(1) NULL, Column12 char(1) NULL, Column13 char(1) NULL, Column14 char(1) NULL, Column15 varchar(10) NULL, Column16 varchar(20) NULL, Column17 varchar(30) NULL, Column18 int NULL, Column19 datetime NULL, Column20 datetime NULL, Loaded datetime NULL, Column22 datetime NULL, Key int NULL );

maranax avatar Jun 26 '20 20:06 maranax

I'm gong to close this issue, no response for a week.

maranax avatar Jul 03 '20 15:07 maranax