Skip to content

Commit 86ba28a

Browse files
authored
SNOW-1308650: revert breaking change and release a newer version (#1916)
1 parent 524eaa7 commit 86ba28a

File tree

9 files changed

+22
-49
lines changed

9 files changed

+22
-49
lines changed

DESCRIPTION.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne
88

99
# Release Notes
1010

11+
- v3.8.1(April 09, 2024)
12+
13+
- Reverted the change "Updated `write_pandas` to skip TABLE IF NOT EXISTS in truncate mode." introduced in v3.8.0 (yanked) as it's a breaking change. `write_pandas` will be fixed in the future in a non-breaking way.
14+
1115
- v3.8.0(April 04,2024)
1216

1317
- Improved `externalbrowser` auth in containerized environments

src/snowflake/connector/pandas_tools.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -393,14 +393,13 @@ def drop_object(name: str, object_type: str) -> None:
393393
quote_identifiers,
394394
)
395395

396-
if auto_create_table:
397-
create_table_sql = (
398-
f"CREATE {table_type.upper()} TABLE IF NOT EXISTS {target_table_location} "
399-
f"({create_table_columns})"
400-
f" /* Python:snowflake.connector.pandas_tools.write_pandas() */ "
401-
)
402-
logger.debug(f"auto creating table with '{create_table_sql}'")
403-
cursor.execute(create_table_sql, _is_internal=True)
396+
create_table_sql = (
397+
f"CREATE {table_type.upper()} TABLE IF NOT EXISTS {target_table_location} "
398+
f"({create_table_columns})"
399+
f" /* Python:snowflake.connector.pandas_tools.write_pandas() */ "
400+
)
401+
logger.debug(f"auto creating table with '{create_table_sql}'")
402+
cursor.execute(create_table_sql, _is_internal=True)
404403
# need explicit casting when the underlying table schema is inferred
405404
parquet_columns = "$1:" + ",$1:".join(
406405
f"{quote}{snowflake_col}{quote}::{column_type_mapping[col]}"

src/snowflake/connector/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Update this for the versions
22
# Don't change the forth version number from None
3-
VERSION = (3, 8, 0, None)
3+
VERSION = (3, 8, 1, None)

test/integ/pandas/test_pandas_tools.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def test_write_pandas_with_overwrite(
115115
f"({col_name} STRING, {col_points} INT, {col_id} INT AUTOINCREMENT)"
116116
)
117117

118-
show_sql = f"SHOW TABLES LIKE '{random_table_name}'" # SHOW command like is case-insensitive
119118
select_sql = f"SELECT * FROM {table_name}"
120119
select_count_sql = f"SELECT count(*) FROM {table_name}"
121120
drop_sql = f"DROP TABLE IF EXISTS {table_name}"
@@ -149,35 +148,6 @@ def test_write_pandas_with_overwrite(
149148
# Check number of rows
150149
assert result["COUNT(*)"] == 1
151150

152-
# Truncate-only mode
153-
if not auto_create_table:
154-
# Capture the created_on timestamp of the target table before truncation
155-
result = cnx.cursor(DictCursor).execute(show_sql).fetchone()
156-
create_ts_before_trunc = result["created_on"]
157-
158-
# This operation should only truncate the table
159-
success, nchunks, nrows, _ = write_pandas(
160-
cnx,
161-
df2,
162-
random_table_name,
163-
quote_identifiers=quote_identifiers,
164-
auto_create_table=auto_create_table,
165-
overwrite=True,
166-
index=index,
167-
)
168-
169-
# Capture the created_on timestamp of the target table after truncation
170-
result = cnx.cursor(DictCursor).execute(show_sql).fetchone()
171-
create_ts_after_trunc = result["created_on"]
172-
assert create_ts_before_trunc == create_ts_after_trunc
173-
174-
# Check write_pandas output
175-
assert success
176-
assert nchunks == 1
177-
result = cnx.cursor(DictCursor).execute(select_count_sql).fetchone()
178-
# Check number of rows
179-
assert result["COUNT(*)"] == 1
180-
181151
# Write dataframe with a different schema
182152
if auto_create_table:
183153
# Should drop table and SUCCEED because the new table will be created with new schema of df3

tested_requirements/requirements_310.reqs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ pytz==2024.1
1515
requests==2.31.0
1616
sortedcontainers==2.4.0
1717
tomlkit==0.12.4
18-
typing_extensions==4.10.0
18+
typing_extensions==4.11.0
1919
urllib3==2.2.1
20-
snowflake-connector-python==3.8.0
20+
snowflake-connector-python==3.8.1

tested_requirements/requirements_311.reqs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ pytz==2024.1
1515
requests==2.31.0
1616
sortedcontainers==2.4.0
1717
tomlkit==0.12.4
18-
typing_extensions==4.10.0
18+
typing_extensions==4.11.0
1919
urllib3==2.2.1
20-
snowflake-connector-python==3.8.0
20+
snowflake-connector-python==3.8.1

tested_requirements/requirements_312.reqs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ requests==2.31.0
1616
setuptools==69.2.0
1717
sortedcontainers==2.4.0
1818
tomlkit==0.12.4
19-
typing_extensions==4.10.0
19+
typing_extensions==4.11.0
2020
urllib3==2.2.1
2121
wheel==0.43.0
22-
snowflake-connector-python==3.8.0
22+
snowflake-connector-python==3.8.1

tested_requirements/requirements_38.reqs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ pytz==2024.1
1515
requests==2.31.0
1616
sortedcontainers==2.4.0
1717
tomlkit==0.12.4
18-
typing_extensions==4.10.0
18+
typing_extensions==4.11.0
1919
urllib3==1.26.18
20-
snowflake-connector-python==3.8.0
20+
snowflake-connector-python==3.8.1

tested_requirements/requirements_39.reqs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ pytz==2024.1
1515
requests==2.31.0
1616
sortedcontainers==2.4.0
1717
tomlkit==0.12.4
18-
typing_extensions==4.10.0
18+
typing_extensions==4.11.0
1919
urllib3==1.26.18
20-
snowflake-connector-python==3.8.0
20+
snowflake-connector-python==3.8.1

0 commit comments

Comments
 (0)