Skip to content

Commit

Permalink
return success
Browse files Browse the repository at this point in the history
  • Loading branch information
tekumara committed Nov 9, 2024
1 parent 6ffb021 commit 93f8347
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions fakesnow/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ def _execute(self, transformed: exp.Expression, params: Sequence[Any] | dict[Any
(affected_count,) = self._duck_conn.fetchall()[0]
result_sql = SQL_DELETED_ROWS.substitute(count=affected_count)

elif cmd == "TRUNCATETABLE":
result_sql = SQL_SUCCESS

elif cmd in ("DESCRIBE TABLE", "DESCRIBE VIEW"):
# DESCRIBE TABLE/VIEW has already been run above to detect and error if the table exists
# We now rerun DESCRIBE TABLE/VIEW but transformed with columns to match Snowflake
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,7 @@ def test_json_extract_cast_as_varchar(dcur: snowflake.connector.cursor.DictCurso

def test_truncate(dcur: snowflake.connector.cursor.DictCursor):
dcur.execute("CREATE TABLE example (i INTEGER)")
dcur.execute("""INSERT INTO example VALUES (1)""")
dcur.execute("INSERT INTO example VALUES (1)")

dcur.execute("TRUNCATE TABLE example")
assert dcur.fetchall() == [{"status": "Statement executed successfully."}]
Expand Down

0 comments on commit 93f8347

Please sign in to comment.