sql-testing-library 0.15.0__tar.gz → 0.16.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/CHANGELOG.md +10 -0
  2. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/PKG-INFO +3 -2
  3. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/README.md +1 -0
  4. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/pyproject.toml +4 -4
  5. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_sql_utils.py +11 -6
  6. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/LICENSE +0 -0
  7. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/__init__.py +0 -0
  8. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_adapters/__init__.py +0 -0
  9. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_adapters/athena.py +0 -0
  10. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_adapters/base.py +0 -0
  11. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_adapters/bigquery.py +0 -0
  12. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_adapters/duckdb.py +0 -0
  13. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_adapters/presto.py +0 -0
  14. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_adapters/redshift.py +0 -0
  15. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_adapters/snowflake.py +0 -0
  16. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_adapters/trino.py +0 -0
  17. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_core.py +0 -0
  18. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_exceptions.py +0 -0
  19. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_mock_table.py +0 -0
  20. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_pytest_plugin.py +0 -0
  21. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_sql_logger.py +0 -0
  22. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/_types.py +0 -0
  23. {sql_testing_library-0.15.0 → sql_testing_library-0.16.0}/src/sql_testing_library/py.typed +0 -0
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 0.16.0 (2025-08-20)
9
+
10
+ ### Feat
11
+
12
+ - upgrade mocksmith to 6.0.1 (#122)
13
+
14
+ ### Fix
15
+
16
+ - upgrade snowflake-connector-python to >=3.13.1 for critical security vulnerabilities (#123)
17
+
8
18
  ## 0.15.0 (2025-07-27)
9
19
 
10
20
  ### Feat
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sql-testing-library
3
- Version: 0.15.0
3
+ Version: 0.16.0
4
4
  Summary: A powerful Python framework for unit testing SQL queries across BigQuery, Snowflake, Redshift, Athena, Trino, and DuckDB with mock data
5
5
  License: MIT
6
6
  Keywords: sql,testing,unit-testing,mock-data,database-testing,bigquery,snowflake,redshift,athena,trino,duckdb,data-engineering,etl-testing,sql-validation,query-testing
@@ -40,7 +40,7 @@ Provides-Extra: redshift
40
40
  Provides-Extra: snowflake
41
41
  Provides-Extra: trino
42
42
  Requires-Dist: db-dtypes (>=1.4.3,<2.0.0)
43
- Requires-Dist: docutils (>=0.21.2,<0.22.0)
43
+ Requires-Dist: docutils (>=0.21.2,<0.23.0)
44
44
  Requires-Dist: pandas (>=1.0.0)
45
45
  Requires-Dist: pydantic (>=2.0.0)
46
46
  Requires-Dist: sqlglot (>=26.0.0)
@@ -66,6 +66,7 @@ A powerful Python framework for unit testing SQL queries with mock data injectio
66
66
  [![Redshift Integration](https://github.com/gurmeetsaran/sqltesting/actions/workflows/redshift-integration.yml/badge.svg)](https://github.com/gurmeetsaran/sqltesting/actions/workflows/redshift-integration.yml)
67
67
  [![Trino Integration](https://github.com/gurmeetsaran/sqltesting/actions/workflows/trino-integration.yml/badge.svg)](https://github.com/gurmeetsaran/sqltesting/actions/workflows/trino-integration.yml)
68
68
  [![Snowflake Integration](https://github.com/gurmeetsaran/sqltesting/actions/workflows/snowflake-integration.yml/badge.svg)](https://github.com/gurmeetsaran/sqltesting/actions/workflows/snowflake-integration.yml)
69
+ [![DuckDB Integration](https://github.com/gurmeetsaran/sqltesting/actions/workflows/duckdb-integration.yml/badge.svg)](https://github.com/gurmeetsaran/sqltesting/actions/workflows/duckdb-integration.yml)
69
70
  [![GitHub license](https://img.shields.io/github/license/gurmeetsaran/sqltesting)](https://github.com/gurmeetsaran/sqltesting/blob/master/LICENSE)
70
71
  [![Pepy Total Downloads](https://img.shields.io/pepy/dt/sql-testing-library?label=PyPI%20Downloads)](https://pepy.tech/projects/sql-testing-library)
71
72
  [![codecov](https://codecov.io/gh/gurmeetsaran/sqltesting/branch/master/graph/badge.svg?token=CN3G5X5ZA5)](https://codecov.io/gh/gurmeetsaran/sqltesting)
@@ -8,6 +8,7 @@ A powerful Python framework for unit testing SQL queries with mock data injectio
8
8
  [![Redshift Integration](https://github.com/gurmeetsaran/sqltesting/actions/workflows/redshift-integration.yml/badge.svg)](https://github.com/gurmeetsaran/sqltesting/actions/workflows/redshift-integration.yml)
9
9
  [![Trino Integration](https://github.com/gurmeetsaran/sqltesting/actions/workflows/trino-integration.yml/badge.svg)](https://github.com/gurmeetsaran/sqltesting/actions/workflows/trino-integration.yml)
10
10
  [![Snowflake Integration](https://github.com/gurmeetsaran/sqltesting/actions/workflows/snowflake-integration.yml/badge.svg)](https://github.com/gurmeetsaran/sqltesting/actions/workflows/snowflake-integration.yml)
11
+ [![DuckDB Integration](https://github.com/gurmeetsaran/sqltesting/actions/workflows/duckdb-integration.yml/badge.svg)](https://github.com/gurmeetsaran/sqltesting/actions/workflows/duckdb-integration.yml)
11
12
  [![GitHub license](https://img.shields.io/github/license/gurmeetsaran/sqltesting)](https://github.com/gurmeetsaran/sqltesting/blob/master/LICENSE)
12
13
  [![Pepy Total Downloads](https://img.shields.io/pepy/dt/sql-testing-library?label=PyPI%20Downloads)](https://pepy.tech/projects/sql-testing-library)
13
14
  [![codecov](https://codecov.io/gh/gurmeetsaran/sqltesting/branch/master/graph/badge.svg?token=CN3G5X5ZA5)](https://codecov.io/gh/gurmeetsaran/sqltesting)
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "sql-testing-library"
7
- version = "0.15.0"
7
+ version = "0.16.0"
8
8
  description = "A powerful Python framework for unit testing SQL queries across BigQuery, Snowflake, Redshift, Athena, Trino, and DuckDB with mock data"
9
9
  authors = ["Gurmeet Saran <gurmeetx@gmail.com>", "Kushal Thakkar <kushal.thakkar@gmail.com>"]
10
10
  maintainers = ["Gurmeet Saran <gurmeetx@gmail.com>", "Kushal Thakkar <kushal.thakkar@gmail.com>"]
@@ -74,7 +74,7 @@ sqlglot = ">=26.0.0"
74
74
  pydantic = ">=2.0.0"
75
75
  pandas = ">=1.0.0"
76
76
  typing-extensions = {version = ">=4.5.0", python = "<3.10"}
77
- docutils = ">=0.21.2,<0.22.0"
77
+ docutils = ">=0.21.2,<0.23.0"
78
78
  db-dtypes = "^1.4.3"
79
79
 
80
80
  [tool.poetry.group.bigquery.dependencies]
@@ -90,7 +90,7 @@ psycopg2-binary = ">=2.9.0"
90
90
  trino = ">=0.322.0"
91
91
 
92
92
  [tool.poetry.group.snowflake.dependencies]
93
- snowflake-connector-python = ">=3.0.0"
93
+ snowflake-connector-python = ">=3.13.1"
94
94
 
95
95
  [tool.poetry.group.duckdb.dependencies]
96
96
  duckdb = ">=0.8.0"
@@ -120,8 +120,8 @@ twine = ">=4.0.0"
120
120
  ruff = ">=0.0.287"
121
121
  pre-commit = ">=3.5.0"
122
122
  commitizen = ">=3.0.0"
123
- mocksmith = {version = ">=3.0.3", extras = ["mock", "pydantic"]}
124
123
  faker = ">=18.0.0" # Explicit dependency to ensure it's installed in CI
124
+ mocksmith = ">=6.0.1"
125
125
 
126
126
  [tool.poetry.plugins.pytest11]
127
127
  sql_testing = "sql_testing_library._pytest_plugin"
@@ -1,5 +1,6 @@
1
1
  """SQL utility functions for escaping and formatting values."""
2
2
 
3
+ import inspect
3
4
  import json
4
5
  from dataclasses import is_dataclass
5
6
  from datetime import date, datetime
@@ -469,14 +470,16 @@ def format_sql_value(value: Any, column_type: Type, dialect: str = "standard") -
469
470
  else:
470
471
  return escape_sql_string(str(value))
471
472
 
472
- # Handle numeric types
473
- elif column_type in (int, float):
474
- return str(value)
475
-
476
- # Handle boolean types
473
+ # Handle boolean types (must come before numeric since bool is subclass of int)
477
474
  elif column_type is bool:
478
475
  return "TRUE" if value else "FALSE"
479
476
 
477
+ # Handle numeric types
478
+ elif column_type in (int, float) or (
479
+ inspect.isclass(column_type) and issubclass(column_type, (int, float))
480
+ ):
481
+ return str(value)
482
+
480
483
  # Handle date types
481
484
  elif column_type is date:
482
485
  if dialect == "bigquery":
@@ -508,7 +511,9 @@ def format_sql_value(value: Any, column_type: Type, dialect: str = "standard") -
508
511
  return f"TIMESTAMP '{value}'"
509
512
 
510
513
  # Handle decimal types
511
- elif column_type == Decimal:
514
+ elif column_type == Decimal or (
515
+ inspect.isclass(column_type) and issubclass(column_type, Decimal)
516
+ ):
512
517
  if dialect == "bigquery":
513
518
  # BigQuery needs explicit NUMERIC casting for decimals
514
519
  return f"NUMERIC '{value}'"