snowflake-sqlalchemy: SNOW-638845: ValueError: unsupported format character with version 1.4.0

Environment:

arrow-cpp                             7.0.0  py310hc7d0c5d_8_cpu  ...     Cached
...
python                               3.10.5  h582c2e5_0_cpython   ...     Cached
...
snowflake-connector-python            2.7.9  py310hbc1ed79_0      ...     Cached
snowflake-sqlalchemy                  1.4.0  pyhd8ed1ab_0         ...     Cached
...
sqlalchemy                           1.4.39  py310h5764c6d_0      ...     Cached

Running some unit tests, excerpt from the logs:

2022-07-28T10:41:44.0418249Z         if self._connection.is_pyformat:
2022-07-28T10:41:44.0418388Z             # pyformat/format paramstyle
2022-07-28T10:41:44.0418503Z             # client side binding
2022-07-28T10:41:44.0418726Z             processed_params = self._connection._process_params_pyformat(params, self)
2022-07-28T10:41:44.0419125Z             # SNOW-513061 collect telemetry for empty sequence usage before we make the breaking change announcement
2022-07-28T10:41:44.0419295Z             if params is not None and len(params) == 0:
2022-07-28T10:41:44.0419604Z                 self._log_telemetry_job_data(
2022-07-28T10:41:44.0419918Z                     TelemetryField.EMPTY_SEQ_INTERPOLATION,
2022-07-28T10:41:44.0420130Z                     TelemetryData.TRUE
2022-07-28T10:41:44.0420454Z                     if self.connection._interpolate_empty_sequences
2022-07-28T10:41:44.0420715Z                     else TelemetryData.FALSE,
2022-07-28T10:41:44.0420905Z                 )
2022-07-28T10:41:44.0421279Z             if logger.getEffectiveLevel() <= logging.DEBUG:
2022-07-28T10:41:44.0421455Z                 logger.debug(
2022-07-28T10:41:44.0421668Z                     f"binding: [***self._format_query_for_log(command)***] "
2022-07-28T10:41:44.0421818Z                     f"with input=[***params***], "
2022-07-28T10:41:44.0421992Z                     f"processed=[***processed_params***]",
2022-07-28T10:41:44.0422086Z                 )
2022-07-28T10:41:44.0422189Z             if (
2022-07-28T10:41:44.0422369Z                 self.connection._interpolate_empty_sequences
2022-07-28T10:41:44.0422520Z                 and processed_params is not None
2022-07-28T10:41:44.0422622Z             ) or (
2022-07-28T10:41:44.0422807Z                 not self.connection._interpolate_empty_sequences
2022-07-28T10:41:44.0422954Z                 and len(processed_params) > 0
2022-07-28T10:41:44.0423054Z             ):
2022-07-28T10:41:44.0423205Z >               query = command % processed_params
2022-07-28T10:41:44.0423664Z E               ValueError: unsupported format character '_' (0x5f) at index 125

Not happening with < 1.4.0.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15

Most upvoted comments

@jtilly thanks for reaching out and sharing us with the reproducing scripts. I’ve updated our test suites to include yours, ran the fix against your scripts and the fix worked as expected. We’ll do a bug fix release soon.