sqlspec 0.47.0__cp314-cp314-win_amd64.whl

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 (621) hide show
  1. f68e0789eb443ecb1c2c__mypyc.cp314-win_amd64.pyd +0 -0
  2. sqlspec/__init__.py +167 -0
  3. sqlspec/__main__.py +12 -0
  4. sqlspec/__metadata__.py +14 -0
  5. sqlspec/_typing.py +714 -0
  6. sqlspec/adapters/__init__.py +0 -0
  7. sqlspec/adapters/adbc/__init__.py +13 -0
  8. sqlspec/adapters/adbc/_typing.py +106 -0
  9. sqlspec/adapters/adbc/adk/__init__.py +5 -0
  10. sqlspec/adapters/adbc/adk/store.py +1280 -0
  11. sqlspec/adapters/adbc/config.py +378 -0
  12. sqlspec/adapters/adbc/core.cp314-win_amd64.pyd +0 -0
  13. sqlspec/adapters/adbc/core.py +922 -0
  14. sqlspec/adapters/adbc/data_dictionary.py +339 -0
  15. sqlspec/adapters/adbc/driver.py +534 -0
  16. sqlspec/adapters/adbc/events/__init__.py +5 -0
  17. sqlspec/adapters/adbc/events/store.py +285 -0
  18. sqlspec/adapters/adbc/litestar/__init__.py +5 -0
  19. sqlspec/adapters/adbc/litestar/store.py +534 -0
  20. sqlspec/adapters/adbc/type_converter.cp314-win_amd64.pyd +0 -0
  21. sqlspec/adapters/adbc/type_converter.py +142 -0
  22. sqlspec/adapters/aiomysql/__init__.py +21 -0
  23. sqlspec/adapters/aiomysql/_typing.py +137 -0
  24. sqlspec/adapters/aiomysql/adk/__init__.py +5 -0
  25. sqlspec/adapters/aiomysql/adk/store.py +678 -0
  26. sqlspec/adapters/aiomysql/config.py +305 -0
  27. sqlspec/adapters/aiomysql/core.cp314-win_amd64.pyd +0 -0
  28. sqlspec/adapters/aiomysql/core.py +536 -0
  29. sqlspec/adapters/aiomysql/data_dictionary.py +121 -0
  30. sqlspec/adapters/aiomysql/driver.py +386 -0
  31. sqlspec/adapters/aiomysql/events/__init__.py +5 -0
  32. sqlspec/adapters/aiomysql/events/store.py +104 -0
  33. sqlspec/adapters/aiomysql/litestar/__init__.py +5 -0
  34. sqlspec/adapters/aiomysql/litestar/store.py +314 -0
  35. sqlspec/adapters/aiosqlite/__init__.py +26 -0
  36. sqlspec/adapters/aiosqlite/_typing.py +109 -0
  37. sqlspec/adapters/aiosqlite/adk/__init__.py +5 -0
  38. sqlspec/adapters/aiosqlite/adk/store.py +829 -0
  39. sqlspec/adapters/aiosqlite/config.py +315 -0
  40. sqlspec/adapters/aiosqlite/core.cp314-win_amd64.pyd +0 -0
  41. sqlspec/adapters/aiosqlite/core.py +315 -0
  42. sqlspec/adapters/aiosqlite/data_dictionary.py +202 -0
  43. sqlspec/adapters/aiosqlite/driver.py +311 -0
  44. sqlspec/adapters/aiosqlite/events/__init__.py +5 -0
  45. sqlspec/adapters/aiosqlite/events/store.py +20 -0
  46. sqlspec/adapters/aiosqlite/litestar/__init__.py +5 -0
  47. sqlspec/adapters/aiosqlite/litestar/store.py +279 -0
  48. sqlspec/adapters/aiosqlite/pool.cp314-win_amd64.pyd +0 -0
  49. sqlspec/adapters/aiosqlite/pool.py +734 -0
  50. sqlspec/adapters/asyncmy/__init__.py +21 -0
  51. sqlspec/adapters/asyncmy/_typing.py +113 -0
  52. sqlspec/adapters/asyncmy/adk/__init__.py +5 -0
  53. sqlspec/adapters/asyncmy/adk/store.py +644 -0
  54. sqlspec/adapters/asyncmy/config.py +307 -0
  55. sqlspec/adapters/asyncmy/core.cp314-win_amd64.pyd +0 -0
  56. sqlspec/adapters/asyncmy/core.py +538 -0
  57. sqlspec/adapters/asyncmy/data_dictionary.py +122 -0
  58. sqlspec/adapters/asyncmy/driver.py +391 -0
  59. sqlspec/adapters/asyncmy/events/__init__.py +5 -0
  60. sqlspec/adapters/asyncmy/events/store.py +104 -0
  61. sqlspec/adapters/asyncmy/litestar/__init__.py +5 -0
  62. sqlspec/adapters/asyncmy/litestar/store.py +296 -0
  63. sqlspec/adapters/asyncpg/__init__.py +26 -0
  64. sqlspec/adapters/asyncpg/_typing.py +103 -0
  65. sqlspec/adapters/asyncpg/adk/__init__.py +5 -0
  66. sqlspec/adapters/asyncpg/adk/store.py +483 -0
  67. sqlspec/adapters/asyncpg/config.py +575 -0
  68. sqlspec/adapters/asyncpg/core.cp314-win_amd64.pyd +0 -0
  69. sqlspec/adapters/asyncpg/core.py +480 -0
  70. sqlspec/adapters/asyncpg/data_dictionary.py +157 -0
  71. sqlspec/adapters/asyncpg/driver.py +487 -0
  72. sqlspec/adapters/asyncpg/events/__init__.py +6 -0
  73. sqlspec/adapters/asyncpg/events/_hub.py +181 -0
  74. sqlspec/adapters/asyncpg/events/backend.py +210 -0
  75. sqlspec/adapters/asyncpg/events/store.py +40 -0
  76. sqlspec/adapters/asyncpg/litestar/__init__.py +5 -0
  77. sqlspec/adapters/asyncpg/litestar/store.py +251 -0
  78. sqlspec/adapters/bigquery/__init__.py +15 -0
  79. sqlspec/adapters/bigquery/_typing.py +108 -0
  80. sqlspec/adapters/bigquery/config.py +362 -0
  81. sqlspec/adapters/bigquery/core.cp314-win_amd64.pyd +0 -0
  82. sqlspec/adapters/bigquery/core.py +768 -0
  83. sqlspec/adapters/bigquery/data_dictionary.py +120 -0
  84. sqlspec/adapters/bigquery/driver.py +542 -0
  85. sqlspec/adapters/bigquery/events/__init__.py +5 -0
  86. sqlspec/adapters/bigquery/events/store.py +139 -0
  87. sqlspec/adapters/bigquery/litestar/__init__.py +5 -0
  88. sqlspec/adapters/bigquery/litestar/store.py +325 -0
  89. sqlspec/adapters/bigquery/type_converter.cp314-win_amd64.pyd +0 -0
  90. sqlspec/adapters/bigquery/type_converter.py +107 -0
  91. sqlspec/adapters/cockroach_asyncpg/__init__.py +26 -0
  92. sqlspec/adapters/cockroach_asyncpg/_typing.py +73 -0
  93. sqlspec/adapters/cockroach_asyncpg/adk/__init__.py +3 -0
  94. sqlspec/adapters/cockroach_asyncpg/adk/store.py +465 -0
  95. sqlspec/adapters/cockroach_asyncpg/config.py +248 -0
  96. sqlspec/adapters/cockroach_asyncpg/core.cp314-win_amd64.pyd +0 -0
  97. sqlspec/adapters/cockroach_asyncpg/core.py +55 -0
  98. sqlspec/adapters/cockroach_asyncpg/data_dictionary.py +110 -0
  99. sqlspec/adapters/cockroach_asyncpg/driver.py +142 -0
  100. sqlspec/adapters/cockroach_asyncpg/events/__init__.py +3 -0
  101. sqlspec/adapters/cockroach_asyncpg/events/store.py +20 -0
  102. sqlspec/adapters/cockroach_asyncpg/litestar/__init__.py +3 -0
  103. sqlspec/adapters/cockroach_asyncpg/litestar/store.py +142 -0
  104. sqlspec/adapters/cockroach_psycopg/__init__.py +39 -0
  105. sqlspec/adapters/cockroach_psycopg/_typing.py +137 -0
  106. sqlspec/adapters/cockroach_psycopg/adk/__init__.py +13 -0
  107. sqlspec/adapters/cockroach_psycopg/adk/store.py +1039 -0
  108. sqlspec/adapters/cockroach_psycopg/config.py +511 -0
  109. sqlspec/adapters/cockroach_psycopg/core.cp314-win_amd64.pyd +0 -0
  110. sqlspec/adapters/cockroach_psycopg/core.py +63 -0
  111. sqlspec/adapters/cockroach_psycopg/data_dictionary.py +220 -0
  112. sqlspec/adapters/cockroach_psycopg/driver.py +273 -0
  113. sqlspec/adapters/cockroach_psycopg/events/__init__.py +6 -0
  114. sqlspec/adapters/cockroach_psycopg/events/store.py +34 -0
  115. sqlspec/adapters/cockroach_psycopg/litestar/__init__.py +3 -0
  116. sqlspec/adapters/cockroach_psycopg/litestar/store.py +327 -0
  117. sqlspec/adapters/duckdb/__init__.py +29 -0
  118. sqlspec/adapters/duckdb/_typing.py +104 -0
  119. sqlspec/adapters/duckdb/adk/__init__.py +14 -0
  120. sqlspec/adapters/duckdb/adk/store.py +935 -0
  121. sqlspec/adapters/duckdb/config.py +386 -0
  122. sqlspec/adapters/duckdb/core.cp314-win_amd64.pyd +0 -0
  123. sqlspec/adapters/duckdb/core.py +332 -0
  124. sqlspec/adapters/duckdb/data_dictionary.py +140 -0
  125. sqlspec/adapters/duckdb/driver.py +426 -0
  126. sqlspec/adapters/duckdb/events/__init__.py +5 -0
  127. sqlspec/adapters/duckdb/events/store.py +57 -0
  128. sqlspec/adapters/duckdb/litestar/__init__.py +5 -0
  129. sqlspec/adapters/duckdb/litestar/store.py +330 -0
  130. sqlspec/adapters/duckdb/pool.cp314-win_amd64.pyd +0 -0
  131. sqlspec/adapters/duckdb/pool.py +350 -0
  132. sqlspec/adapters/duckdb/type_converter.cp314-win_amd64.pyd +0 -0
  133. sqlspec/adapters/duckdb/type_converter.py +118 -0
  134. sqlspec/adapters/mysqlconnector/__init__.py +39 -0
  135. sqlspec/adapters/mysqlconnector/_typing.py +186 -0
  136. sqlspec/adapters/mysqlconnector/adk/__init__.py +15 -0
  137. sqlspec/adapters/mysqlconnector/adk/store.py +1183 -0
  138. sqlspec/adapters/mysqlconnector/config.py +421 -0
  139. sqlspec/adapters/mysqlconnector/core.cp314-win_amd64.pyd +0 -0
  140. sqlspec/adapters/mysqlconnector/core.py +472 -0
  141. sqlspec/adapters/mysqlconnector/data_dictionary.py +230 -0
  142. sqlspec/adapters/mysqlconnector/driver.py +516 -0
  143. sqlspec/adapters/mysqlconnector/events/__init__.py +8 -0
  144. sqlspec/adapters/mysqlconnector/events/store.py +98 -0
  145. sqlspec/adapters/mysqlconnector/litestar/__init__.py +5 -0
  146. sqlspec/adapters/mysqlconnector/litestar/store.py +426 -0
  147. sqlspec/adapters/oracledb/__init__.py +39 -0
  148. sqlspec/adapters/oracledb/_json_handlers.cp314-win_amd64.pyd +0 -0
  149. sqlspec/adapters/oracledb/_json_handlers.py +196 -0
  150. sqlspec/adapters/oracledb/_param_types.cp314-win_amd64.pyd +0 -0
  151. sqlspec/adapters/oracledb/_param_types.py +46 -0
  152. sqlspec/adapters/oracledb/_typing.py +258 -0
  153. sqlspec/adapters/oracledb/_uuid_handlers.cp314-win_amd64.pyd +0 -0
  154. sqlspec/adapters/oracledb/_uuid_handlers.py +163 -0
  155. sqlspec/adapters/oracledb/_vector_handlers.cp314-win_amd64.pyd +0 -0
  156. sqlspec/adapters/oracledb/_vector_handlers.py +228 -0
  157. sqlspec/adapters/oracledb/adk/__init__.py +21 -0
  158. sqlspec/adapters/oracledb/adk/store.py +2453 -0
  159. sqlspec/adapters/oracledb/config.py +575 -0
  160. sqlspec/adapters/oracledb/core.cp314-win_amd64.pyd +0 -0
  161. sqlspec/adapters/oracledb/core.py +820 -0
  162. sqlspec/adapters/oracledb/data_dictionary.py +404 -0
  163. sqlspec/adapters/oracledb/driver.py +1277 -0
  164. sqlspec/adapters/oracledb/events/__init__.py +16 -0
  165. sqlspec/adapters/oracledb/events/_hub.py +345 -0
  166. sqlspec/adapters/oracledb/events/backend.py +300 -0
  167. sqlspec/adapters/oracledb/events/store.py +420 -0
  168. sqlspec/adapters/oracledb/litestar/__init__.py +5 -0
  169. sqlspec/adapters/oracledb/litestar/store.py +781 -0
  170. sqlspec/adapters/oracledb/migrations.py +539 -0
  171. sqlspec/adapters/oracledb/type_converter.cp314-win_amd64.pyd +0 -0
  172. sqlspec/adapters/oracledb/type_converter.py +211 -0
  173. sqlspec/adapters/psqlpy/__init__.py +18 -0
  174. sqlspec/adapters/psqlpy/_typing.py +121 -0
  175. sqlspec/adapters/psqlpy/adk/__init__.py +5 -0
  176. sqlspec/adapters/psqlpy/adk/store.py +591 -0
  177. sqlspec/adapters/psqlpy/config.py +376 -0
  178. sqlspec/adapters/psqlpy/core.cp314-win_amd64.pyd +0 -0
  179. sqlspec/adapters/psqlpy/core.py +694 -0
  180. sqlspec/adapters/psqlpy/data_dictionary.py +121 -0
  181. sqlspec/adapters/psqlpy/driver.py +411 -0
  182. sqlspec/adapters/psqlpy/events/__init__.py +6 -0
  183. sqlspec/adapters/psqlpy/events/_hub.py +204 -0
  184. sqlspec/adapters/psqlpy/events/backend.py +210 -0
  185. sqlspec/adapters/psqlpy/events/store.py +20 -0
  186. sqlspec/adapters/psqlpy/litestar/__init__.py +5 -0
  187. sqlspec/adapters/psqlpy/litestar/store.py +270 -0
  188. sqlspec/adapters/psqlpy/type_converter.cp314-win_amd64.pyd +0 -0
  189. sqlspec/adapters/psqlpy/type_converter.py +113 -0
  190. sqlspec/adapters/psycopg/__init__.py +38 -0
  191. sqlspec/adapters/psycopg/_typing.py +218 -0
  192. sqlspec/adapters/psycopg/adk/__init__.py +10 -0
  193. sqlspec/adapters/psycopg/adk/store.py +1106 -0
  194. sqlspec/adapters/psycopg/config.py +695 -0
  195. sqlspec/adapters/psycopg/core.cp314-win_amd64.pyd +0 -0
  196. sqlspec/adapters/psycopg/core.py +520 -0
  197. sqlspec/adapters/psycopg/data_dictionary.py +278 -0
  198. sqlspec/adapters/psycopg/driver.py +1033 -0
  199. sqlspec/adapters/psycopg/events/__init__.py +20 -0
  200. sqlspec/adapters/psycopg/events/_hub.py +388 -0
  201. sqlspec/adapters/psycopg/events/backend.py +398 -0
  202. sqlspec/adapters/psycopg/events/store.py +42 -0
  203. sqlspec/adapters/psycopg/litestar/__init__.py +5 -0
  204. sqlspec/adapters/psycopg/litestar/store.py +554 -0
  205. sqlspec/adapters/psycopg/type_converter.cp314-win_amd64.pyd +0 -0
  206. sqlspec/adapters/psycopg/type_converter.py +93 -0
  207. sqlspec/adapters/pymysql/__init__.py +21 -0
  208. sqlspec/adapters/pymysql/_typing.py +92 -0
  209. sqlspec/adapters/pymysql/adk/__init__.py +5 -0
  210. sqlspec/adapters/pymysql/adk/store.py +657 -0
  211. sqlspec/adapters/pymysql/config.py +176 -0
  212. sqlspec/adapters/pymysql/core.cp314-win_amd64.pyd +0 -0
  213. sqlspec/adapters/pymysql/core.py +469 -0
  214. sqlspec/adapters/pymysql/data_dictionary.py +120 -0
  215. sqlspec/adapters/pymysql/driver.py +271 -0
  216. sqlspec/adapters/pymysql/events/__init__.py +5 -0
  217. sqlspec/adapters/pymysql/events/store.py +50 -0
  218. sqlspec/adapters/pymysql/litestar/__init__.py +5 -0
  219. sqlspec/adapters/pymysql/litestar/store.py +232 -0
  220. sqlspec/adapters/pymysql/pool.cp314-win_amd64.pyd +0 -0
  221. sqlspec/adapters/pymysql/pool.py +184 -0
  222. sqlspec/adapters/spanner/__init__.py +33 -0
  223. sqlspec/adapters/spanner/_typing.py +102 -0
  224. sqlspec/adapters/spanner/adk/__init__.py +5 -0
  225. sqlspec/adapters/spanner/adk/store.py +758 -0
  226. sqlspec/adapters/spanner/config.py +355 -0
  227. sqlspec/adapters/spanner/core.cp314-win_amd64.pyd +0 -0
  228. sqlspec/adapters/spanner/core.py +263 -0
  229. sqlspec/adapters/spanner/data_dictionary.py +120 -0
  230. sqlspec/adapters/spanner/driver.py +407 -0
  231. sqlspec/adapters/spanner/events/__init__.py +5 -0
  232. sqlspec/adapters/spanner/events/store.py +187 -0
  233. sqlspec/adapters/spanner/litestar/__init__.py +5 -0
  234. sqlspec/adapters/spanner/litestar/store.py +291 -0
  235. sqlspec/adapters/spanner/type_converter.cp314-win_amd64.pyd +0 -0
  236. sqlspec/adapters/spanner/type_converter.py +342 -0
  237. sqlspec/adapters/sqlite/__init__.py +19 -0
  238. sqlspec/adapters/sqlite/_typing.py +123 -0
  239. sqlspec/adapters/sqlite/adk/__init__.py +5 -0
  240. sqlspec/adapters/sqlite/adk/store.py +992 -0
  241. sqlspec/adapters/sqlite/config.py +240 -0
  242. sqlspec/adapters/sqlite/core.cp314-win_amd64.pyd +0 -0
  243. sqlspec/adapters/sqlite/core.py +357 -0
  244. sqlspec/adapters/sqlite/data_dictionary.py +198 -0
  245. sqlspec/adapters/sqlite/driver.py +527 -0
  246. sqlspec/adapters/sqlite/events/__init__.py +5 -0
  247. sqlspec/adapters/sqlite/events/store.py +20 -0
  248. sqlspec/adapters/sqlite/litestar/__init__.py +5 -0
  249. sqlspec/adapters/sqlite/litestar/store.py +316 -0
  250. sqlspec/adapters/sqlite/pool.cp314-win_amd64.pyd +0 -0
  251. sqlspec/adapters/sqlite/pool.py +237 -0
  252. sqlspec/adapters/sqlite/type_converter.cp314-win_amd64.pyd +0 -0
  253. sqlspec/adapters/sqlite/type_converter.py +114 -0
  254. sqlspec/base.py +832 -0
  255. sqlspec/builder/__init__.py +181 -0
  256. sqlspec/builder/_base.cp314-win_amd64.pyd +0 -0
  257. sqlspec/builder/_base.py +1071 -0
  258. sqlspec/builder/_column.cp314-win_amd64.pyd +0 -0
  259. sqlspec/builder/_column.py +521 -0
  260. sqlspec/builder/_ddl.cp314-win_amd64.pyd +0 -0
  261. sqlspec/builder/_ddl.py +1691 -0
  262. sqlspec/builder/_delete.cp314-win_amd64.pyd +0 -0
  263. sqlspec/builder/_delete.py +95 -0
  264. sqlspec/builder/_dml.cp314-win_amd64.pyd +0 -0
  265. sqlspec/builder/_dml.py +386 -0
  266. sqlspec/builder/_explain.cp314-win_amd64.pyd +0 -0
  267. sqlspec/builder/_explain.py +579 -0
  268. sqlspec/builder/_expression_wrappers.cp314-win_amd64.pyd +0 -0
  269. sqlspec/builder/_expression_wrappers.py +46 -0
  270. sqlspec/builder/_factory.cp314-win_amd64.pyd +0 -0
  271. sqlspec/builder/_factory.py +1884 -0
  272. sqlspec/builder/_insert.cp314-win_amd64.pyd +0 -0
  273. sqlspec/builder/_insert.py +405 -0
  274. sqlspec/builder/_join.cp314-win_amd64.pyd +0 -0
  275. sqlspec/builder/_join.py +489 -0
  276. sqlspec/builder/_merge.cp314-win_amd64.pyd +0 -0
  277. sqlspec/builder/_merge.py +823 -0
  278. sqlspec/builder/_parsing_utils.cp314-win_amd64.pyd +0 -0
  279. sqlspec/builder/_parsing_utils.py +295 -0
  280. sqlspec/builder/_select.cp314-win_amd64.pyd +0 -0
  281. sqlspec/builder/_select.py +1666 -0
  282. sqlspec/builder/_temporal.cp314-win_amd64.pyd +0 -0
  283. sqlspec/builder/_temporal.py +167 -0
  284. sqlspec/builder/_update.cp314-win_amd64.pyd +0 -0
  285. sqlspec/builder/_update.py +173 -0
  286. sqlspec/builder/_vector_distance.cp314-win_amd64.pyd +0 -0
  287. sqlspec/builder/_vector_distance.py +330 -0
  288. sqlspec/cli.py +1095 -0
  289. sqlspec/config.py +2383 -0
  290. sqlspec/core/__init__.py +372 -0
  291. sqlspec/core/_correlation.cp314-win_amd64.pyd +0 -0
  292. sqlspec/core/_correlation.py +176 -0
  293. sqlspec/core/_pagination.py +42 -0
  294. sqlspec/core/_pool.cp314-win_amd64.pyd +0 -0
  295. sqlspec/core/_pool.py +76 -0
  296. sqlspec/core/cache.cp314-win_amd64.pyd +0 -0
  297. sqlspec/core/cache.py +1085 -0
  298. sqlspec/core/compiler.cp314-win_amd64.pyd +0 -0
  299. sqlspec/core/compiler.py +1090 -0
  300. sqlspec/core/config_runtime.cp314-win_amd64.pyd +0 -0
  301. sqlspec/core/config_runtime.py +174 -0
  302. sqlspec/core/explain.cp314-win_amd64.pyd +0 -0
  303. sqlspec/core/explain.py +275 -0
  304. sqlspec/core/filters.cp314-win_amd64.pyd +0 -0
  305. sqlspec/core/filters.py +969 -0
  306. sqlspec/core/hashing.cp314-win_amd64.pyd +0 -0
  307. sqlspec/core/hashing.py +266 -0
  308. sqlspec/core/metrics.cp314-win_amd64.pyd +0 -0
  309. sqlspec/core/metrics.py +83 -0
  310. sqlspec/core/parameters/__init__.py +72 -0
  311. sqlspec/core/parameters/_alignment.cp314-win_amd64.pyd +0 -0
  312. sqlspec/core/parameters/_alignment.py +283 -0
  313. sqlspec/core/parameters/_converter.cp314-win_amd64.pyd +0 -0
  314. sqlspec/core/parameters/_converter.py +554 -0
  315. sqlspec/core/parameters/_processor.cp314-win_amd64.pyd +0 -0
  316. sqlspec/core/parameters/_processor.py +1182 -0
  317. sqlspec/core/parameters/_registry.cp314-win_amd64.pyd +0 -0
  318. sqlspec/core/parameters/_registry.py +206 -0
  319. sqlspec/core/parameters/_transformers.cp314-win_amd64.pyd +0 -0
  320. sqlspec/core/parameters/_transformers.py +324 -0
  321. sqlspec/core/parameters/_types.cp314-win_amd64.pyd +0 -0
  322. sqlspec/core/parameters/_types.py +536 -0
  323. sqlspec/core/parameters/_validator.cp314-win_amd64.pyd +0 -0
  324. sqlspec/core/parameters/_validator.py +171 -0
  325. sqlspec/core/pipeline.cp314-win_amd64.pyd +0 -0
  326. sqlspec/core/pipeline.py +333 -0
  327. sqlspec/core/query_modifiers.cp314-win_amd64.pyd +0 -0
  328. sqlspec/core/query_modifiers.py +508 -0
  329. sqlspec/core/result/__init__.py +25 -0
  330. sqlspec/core/result/_base.cp314-win_amd64.pyd +0 -0
  331. sqlspec/core/result/_base.py +1232 -0
  332. sqlspec/core/result/_io.cp314-win_amd64.pyd +0 -0
  333. sqlspec/core/result/_io.py +28 -0
  334. sqlspec/core/splitter.cp314-win_amd64.pyd +0 -0
  335. sqlspec/core/splitter.py +1021 -0
  336. sqlspec/core/sqlcommenter.cp314-win_amd64.pyd +0 -0
  337. sqlspec/core/sqlcommenter.py +249 -0
  338. sqlspec/core/stack.cp314-win_amd64.pyd +0 -0
  339. sqlspec/core/stack.py +163 -0
  340. sqlspec/core/statement.cp314-win_amd64.pyd +0 -0
  341. sqlspec/core/statement.py +1865 -0
  342. sqlspec/core/type_converter.cp314-win_amd64.pyd +0 -0
  343. sqlspec/core/type_converter.py +340 -0
  344. sqlspec/data_dictionary/__init__.py +22 -0
  345. sqlspec/data_dictionary/_loader.cp314-win_amd64.pyd +0 -0
  346. sqlspec/data_dictionary/_loader.py +138 -0
  347. sqlspec/data_dictionary/_registry.cp314-win_amd64.pyd +0 -0
  348. sqlspec/data_dictionary/_registry.py +74 -0
  349. sqlspec/data_dictionary/_types.cp314-win_amd64.pyd +0 -0
  350. sqlspec/data_dictionary/_types.py +121 -0
  351. sqlspec/data_dictionary/dialects/__init__.py +21 -0
  352. sqlspec/data_dictionary/dialects/bigquery.cp314-win_amd64.pyd +0 -0
  353. sqlspec/data_dictionary/dialects/bigquery.py +81 -0
  354. sqlspec/data_dictionary/dialects/cockroachdb.cp314-win_amd64.pyd +0 -0
  355. sqlspec/data_dictionary/dialects/cockroachdb.py +54 -0
  356. sqlspec/data_dictionary/dialects/duckdb.cp314-win_amd64.pyd +0 -0
  357. sqlspec/data_dictionary/dialects/duckdb.py +47 -0
  358. sqlspec/data_dictionary/dialects/mysql.cp314-win_amd64.pyd +0 -0
  359. sqlspec/data_dictionary/dialects/mysql.py +53 -0
  360. sqlspec/data_dictionary/dialects/oracle.cp314-win_amd64.pyd +0 -0
  361. sqlspec/data_dictionary/dialects/oracle.py +197 -0
  362. sqlspec/data_dictionary/dialects/postgres.cp314-win_amd64.pyd +0 -0
  363. sqlspec/data_dictionary/dialects/postgres.py +69 -0
  364. sqlspec/data_dictionary/dialects/spanner.cp314-win_amd64.pyd +0 -0
  365. sqlspec/data_dictionary/dialects/spanner.py +37 -0
  366. sqlspec/data_dictionary/dialects/sqlite.cp314-win_amd64.pyd +0 -0
  367. sqlspec/data_dictionary/dialects/sqlite.py +59 -0
  368. sqlspec/data_dictionary/sql/.gitkeep +0 -0
  369. sqlspec/data_dictionary/sql/bigquery/columns.sql +23 -0
  370. sqlspec/data_dictionary/sql/bigquery/foreign_keys.sql +34 -0
  371. sqlspec/data_dictionary/sql/bigquery/indexes.sql +19 -0
  372. sqlspec/data_dictionary/sql/bigquery/tables.sql +33 -0
  373. sqlspec/data_dictionary/sql/bigquery/version.sql +3 -0
  374. sqlspec/data_dictionary/sql/cockroachdb/columns.sql +34 -0
  375. sqlspec/data_dictionary/sql/cockroachdb/foreign_keys.sql +40 -0
  376. sqlspec/data_dictionary/sql/cockroachdb/indexes.sql +32 -0
  377. sqlspec/data_dictionary/sql/cockroachdb/tables.sql +44 -0
  378. sqlspec/data_dictionary/sql/cockroachdb/version.sql +3 -0
  379. sqlspec/data_dictionary/sql/duckdb/columns.sql +23 -0
  380. sqlspec/data_dictionary/sql/duckdb/foreign_keys.sql +36 -0
  381. sqlspec/data_dictionary/sql/duckdb/indexes.sql +19 -0
  382. sqlspec/data_dictionary/sql/duckdb/tables.sql +38 -0
  383. sqlspec/data_dictionary/sql/duckdb/version.sql +3 -0
  384. sqlspec/data_dictionary/sql/mysql/columns.sql +23 -0
  385. sqlspec/data_dictionary/sql/mysql/foreign_keys.sql +28 -0
  386. sqlspec/data_dictionary/sql/mysql/indexes.sql +26 -0
  387. sqlspec/data_dictionary/sql/mysql/tables.sql +33 -0
  388. sqlspec/data_dictionary/sql/mysql/version.sql +3 -0
  389. sqlspec/data_dictionary/sql/oracle/columns.sql +23 -0
  390. sqlspec/data_dictionary/sql/oracle/foreign_keys.sql +48 -0
  391. sqlspec/data_dictionary/sql/oracle/indexes.sql +44 -0
  392. sqlspec/data_dictionary/sql/oracle/tables.sql +25 -0
  393. sqlspec/data_dictionary/sql/oracle/version.sql +20 -0
  394. sqlspec/data_dictionary/sql/postgres/columns.sql +34 -0
  395. sqlspec/data_dictionary/sql/postgres/foreign_keys.sql +40 -0
  396. sqlspec/data_dictionary/sql/postgres/indexes.sql +56 -0
  397. sqlspec/data_dictionary/sql/postgres/tables.sql +44 -0
  398. sqlspec/data_dictionary/sql/postgres/version.sql +3 -0
  399. sqlspec/data_dictionary/sql/spanner/columns.sql +23 -0
  400. sqlspec/data_dictionary/sql/spanner/foreign_keys.sql +70 -0
  401. sqlspec/data_dictionary/sql/spanner/indexes.sql +30 -0
  402. sqlspec/data_dictionary/sql/spanner/tables.sql +9 -0
  403. sqlspec/data_dictionary/sql/spanner/version.sql +3 -0
  404. sqlspec/data_dictionary/sql/sqlite/columns.sql +23 -0
  405. sqlspec/data_dictionary/sql/sqlite/foreign_keys.sql +22 -0
  406. sqlspec/data_dictionary/sql/sqlite/indexes.sql +7 -0
  407. sqlspec/data_dictionary/sql/sqlite/tables.sql +28 -0
  408. sqlspec/data_dictionary/sql/sqlite/version.sql +3 -0
  409. sqlspec/dialects/__init__.py +22 -0
  410. sqlspec/dialects/_compat.cp314-win_amd64.pyd +0 -0
  411. sqlspec/dialects/_compat.py +14 -0
  412. sqlspec/dialects/postgres/__init__.py +9 -0
  413. sqlspec/dialects/postgres/_generators.cp314-win_amd64.pyd +0 -0
  414. sqlspec/dialects/postgres/_generators.py +57 -0
  415. sqlspec/dialects/postgres/_operators.cp314-win_amd64.pyd +0 -0
  416. sqlspec/dialects/postgres/_operators.py +81 -0
  417. sqlspec/dialects/postgres/_paradedb.py +50 -0
  418. sqlspec/dialects/postgres/_pgvector.py +36 -0
  419. sqlspec/dialects/spanner/__init__.py +6 -0
  420. sqlspec/dialects/spanner/_generators.cp314-win_amd64.pyd +0 -0
  421. sqlspec/dialects/spanner/_generators.py +206 -0
  422. sqlspec/dialects/spanner/_spangres.py +77 -0
  423. sqlspec/dialects/spanner/_spanner.py +179 -0
  424. sqlspec/driver/__init__.py +49 -0
  425. sqlspec/driver/_async.cp314-win_amd64.pyd +0 -0
  426. sqlspec/driver/_async.py +1830 -0
  427. sqlspec/driver/_common.cp314-win_amd64.pyd +0 -0
  428. sqlspec/driver/_common.py +2292 -0
  429. sqlspec/driver/_exception_handler.cp314-win_amd64.pyd +0 -0
  430. sqlspec/driver/_exception_handler.py +108 -0
  431. sqlspec/driver/_query_cache.cp314-win_amd64.pyd +0 -0
  432. sqlspec/driver/_query_cache.py +96 -0
  433. sqlspec/driver/_sql_helpers.cp314-win_amd64.pyd +0 -0
  434. sqlspec/driver/_sql_helpers.py +139 -0
  435. sqlspec/driver/_storage_helpers.cp314-win_amd64.pyd +0 -0
  436. sqlspec/driver/_storage_helpers.py +153 -0
  437. sqlspec/driver/_sync.cp314-win_amd64.pyd +0 -0
  438. sqlspec/driver/_sync.py +1817 -0
  439. sqlspec/exceptions.cp314-win_amd64.pyd +0 -0
  440. sqlspec/exceptions.py +480 -0
  441. sqlspec/extensions/__init__.py +0 -0
  442. sqlspec/extensions/adk/__init__.py +84 -0
  443. sqlspec/extensions/adk/_config_utils.py +199 -0
  444. sqlspec/extensions/adk/_types.cp314-win_amd64.pyd +0 -0
  445. sqlspec/extensions/adk/_types.py +41 -0
  446. sqlspec/extensions/adk/artifact/__init__.py +57 -0
  447. sqlspec/extensions/adk/artifact/_types.cp314-win_amd64.pyd +0 -0
  448. sqlspec/extensions/adk/artifact/_types.py +32 -0
  449. sqlspec/extensions/adk/artifact/service.py +508 -0
  450. sqlspec/extensions/adk/artifact/store.py +361 -0
  451. sqlspec/extensions/adk/converters.py +212 -0
  452. sqlspec/extensions/adk/memory/__init__.py +69 -0
  453. sqlspec/extensions/adk/memory/_types.cp314-win_amd64.pyd +0 -0
  454. sqlspec/extensions/adk/memory/_types.py +30 -0
  455. sqlspec/extensions/adk/memory/converters.py +225 -0
  456. sqlspec/extensions/adk/memory/service.py +316 -0
  457. sqlspec/extensions/adk/memory/store.py +525 -0
  458. sqlspec/extensions/adk/migrations/0001_create_adk_tables.py +184 -0
  459. sqlspec/extensions/adk/migrations/__init__.py +0 -0
  460. sqlspec/extensions/adk/service.py +279 -0
  461. sqlspec/extensions/adk/store.py +590 -0
  462. sqlspec/extensions/events/__init__.py +51 -0
  463. sqlspec/extensions/events/_channel.py +703 -0
  464. sqlspec/extensions/events/_hints.cp314-win_amd64.pyd +0 -0
  465. sqlspec/extensions/events/_hints.py +45 -0
  466. sqlspec/extensions/events/_models.py +23 -0
  467. sqlspec/extensions/events/_payload.cp314-win_amd64.pyd +0 -0
  468. sqlspec/extensions/events/_payload.py +69 -0
  469. sqlspec/extensions/events/_protocols.py +134 -0
  470. sqlspec/extensions/events/_queue.py +462 -0
  471. sqlspec/extensions/events/_store.py +209 -0
  472. sqlspec/extensions/events/migrations/0001_create_event_queue.py +59 -0
  473. sqlspec/extensions/events/migrations/__init__.py +3 -0
  474. sqlspec/extensions/fastapi/__init__.py +22 -0
  475. sqlspec/extensions/fastapi/extension.py +391 -0
  476. sqlspec/extensions/fastapi/providers.cp314-win_amd64.pyd +0 -0
  477. sqlspec/extensions/fastapi/providers.py +712 -0
  478. sqlspec/extensions/flask/__init__.py +38 -0
  479. sqlspec/extensions/flask/_state.py +87 -0
  480. sqlspec/extensions/flask/_utils.py +71 -0
  481. sqlspec/extensions/flask/extension.py +539 -0
  482. sqlspec/extensions/litestar/__init__.py +31 -0
  483. sqlspec/extensions/litestar/_utils.py +52 -0
  484. sqlspec/extensions/litestar/channels.py +165 -0
  485. sqlspec/extensions/litestar/cli.py +102 -0
  486. sqlspec/extensions/litestar/config.py +90 -0
  487. sqlspec/extensions/litestar/handlers.py +316 -0
  488. sqlspec/extensions/litestar/migrations/0001_create_session_table.py +137 -0
  489. sqlspec/extensions/litestar/migrations/__init__.py +3 -0
  490. sqlspec/extensions/litestar/plugin.py +1066 -0
  491. sqlspec/extensions/litestar/providers.cp314-win_amd64.pyd +0 -0
  492. sqlspec/extensions/litestar/providers.py +784 -0
  493. sqlspec/extensions/litestar/store.py +298 -0
  494. sqlspec/extensions/otel/__init__.py +58 -0
  495. sqlspec/extensions/prometheus/__init__.py +113 -0
  496. sqlspec/extensions/sanic/__init__.py +19 -0
  497. sqlspec/extensions/sanic/_state.py +43 -0
  498. sqlspec/extensions/sanic/_utils.py +127 -0
  499. sqlspec/extensions/sanic/extension.py +647 -0
  500. sqlspec/extensions/starlette/__init__.py +22 -0
  501. sqlspec/extensions/starlette/_state.py +42 -0
  502. sqlspec/extensions/starlette/_utils.py +96 -0
  503. sqlspec/extensions/starlette/extension.py +374 -0
  504. sqlspec/extensions/starlette/middleware.py +281 -0
  505. sqlspec/loader.cp314-win_amd64.pyd +0 -0
  506. sqlspec/loader.py +727 -0
  507. sqlspec/migrations/__init__.py +39 -0
  508. sqlspec/migrations/base.cp314-win_amd64.pyd +0 -0
  509. sqlspec/migrations/base.py +862 -0
  510. sqlspec/migrations/commands.py +2151 -0
  511. sqlspec/migrations/context.cp314-win_amd64.pyd +0 -0
  512. sqlspec/migrations/context.py +157 -0
  513. sqlspec/migrations/fix.cp314-win_amd64.pyd +0 -0
  514. sqlspec/migrations/fix.py +204 -0
  515. sqlspec/migrations/loaders.cp314-win_amd64.pyd +0 -0
  516. sqlspec/migrations/loaders.py +443 -0
  517. sqlspec/migrations/runner.cp314-win_amd64.pyd +0 -0
  518. sqlspec/migrations/runner.py +1195 -0
  519. sqlspec/migrations/squash.cp314-win_amd64.pyd +0 -0
  520. sqlspec/migrations/squash.py +490 -0
  521. sqlspec/migrations/templates.cp314-win_amd64.pyd +0 -0
  522. sqlspec/migrations/templates.py +234 -0
  523. sqlspec/migrations/tracker.cp314-win_amd64.pyd +0 -0
  524. sqlspec/migrations/tracker.py +792 -0
  525. sqlspec/migrations/utils.cp314-win_amd64.pyd +0 -0
  526. sqlspec/migrations/utils.py +256 -0
  527. sqlspec/migrations/validation.cp314-win_amd64.pyd +0 -0
  528. sqlspec/migrations/validation.py +359 -0
  529. sqlspec/migrations/version.cp314-win_amd64.pyd +0 -0
  530. sqlspec/migrations/version.py +446 -0
  531. sqlspec/observability/__init__.py +57 -0
  532. sqlspec/observability/_common.cp314-win_amd64.pyd +0 -0
  533. sqlspec/observability/_common.py +77 -0
  534. sqlspec/observability/_config.cp314-win_amd64.pyd +0 -0
  535. sqlspec/observability/_config.py +364 -0
  536. sqlspec/observability/_diagnostics.cp314-win_amd64.pyd +0 -0
  537. sqlspec/observability/_diagnostics.py +74 -0
  538. sqlspec/observability/_dispatcher.cp314-win_amd64.pyd +0 -0
  539. sqlspec/observability/_dispatcher.py +200 -0
  540. sqlspec/observability/_formatters/__init__.py +13 -0
  541. sqlspec/observability/_formatters/_aws.cp314-win_amd64.pyd +0 -0
  542. sqlspec/observability/_formatters/_aws.py +102 -0
  543. sqlspec/observability/_formatters/_azure.cp314-win_amd64.pyd +0 -0
  544. sqlspec/observability/_formatters/_azure.py +96 -0
  545. sqlspec/observability/_formatters/_base.cp314-win_amd64.pyd +0 -0
  546. sqlspec/observability/_formatters/_base.py +57 -0
  547. sqlspec/observability/_formatters/_gcp.cp314-win_amd64.pyd +0 -0
  548. sqlspec/observability/_formatters/_gcp.py +131 -0
  549. sqlspec/observability/_formatting.py +58 -0
  550. sqlspec/observability/_observer.cp314-win_amd64.pyd +0 -0
  551. sqlspec/observability/_observer.py +361 -0
  552. sqlspec/observability/_runtime.cp314-win_amd64.pyd +0 -0
  553. sqlspec/observability/_runtime.py +461 -0
  554. sqlspec/observability/_sampling.cp314-win_amd64.pyd +0 -0
  555. sqlspec/observability/_sampling.py +188 -0
  556. sqlspec/observability/_spans.cp314-win_amd64.pyd +0 -0
  557. sqlspec/observability/_spans.py +161 -0
  558. sqlspec/protocols.py +955 -0
  559. sqlspec/py.typed +0 -0
  560. sqlspec/service.py +433 -0
  561. sqlspec/storage/__init__.py +48 -0
  562. sqlspec/storage/_arrow_payload.py +68 -0
  563. sqlspec/storage/_paths.cp314-win_amd64.pyd +0 -0
  564. sqlspec/storage/_paths.py +58 -0
  565. sqlspec/storage/_utils.py +46 -0
  566. sqlspec/storage/backends/__init__.py +1 -0
  567. sqlspec/storage/backends/base.cp314-win_amd64.pyd +0 -0
  568. sqlspec/storage/backends/base.py +374 -0
  569. sqlspec/storage/backends/fsspec.py +574 -0
  570. sqlspec/storage/backends/local.py +468 -0
  571. sqlspec/storage/backends/obstore.py +956 -0
  572. sqlspec/storage/errors.cp314-win_amd64.pyd +0 -0
  573. sqlspec/storage/errors.py +102 -0
  574. sqlspec/storage/pipeline.cp314-win_amd64.pyd +0 -0
  575. sqlspec/storage/pipeline.py +628 -0
  576. sqlspec/storage/registry.cp314-win_amd64.pyd +0 -0
  577. sqlspec/storage/registry.py +329 -0
  578. sqlspec/typing.py +405 -0
  579. sqlspec/utils/__init__.py +7 -0
  580. sqlspec/utils/arrow_helpers.py +384 -0
  581. sqlspec/utils/config_tools.cp314-win_amd64.pyd +0 -0
  582. sqlspec/utils/config_tools.py +314 -0
  583. sqlspec/utils/correlation.cp314-win_amd64.pyd +0 -0
  584. sqlspec/utils/correlation.py +134 -0
  585. sqlspec/utils/deprecation.cp314-win_amd64.pyd +0 -0
  586. sqlspec/utils/deprecation.py +157 -0
  587. sqlspec/utils/dispatch.cp314-win_amd64.pyd +0 -0
  588. sqlspec/utils/dispatch.py +101 -0
  589. sqlspec/utils/fixtures.cp314-win_amd64.pyd +0 -0
  590. sqlspec/utils/fixtures.py +260 -0
  591. sqlspec/utils/logging.cp314-win_amd64.pyd +0 -0
  592. sqlspec/utils/logging.py +251 -0
  593. sqlspec/utils/module_loader.py +306 -0
  594. sqlspec/utils/portal.cp314-win_amd64.pyd +0 -0
  595. sqlspec/utils/portal.py +377 -0
  596. sqlspec/utils/schema.cp314-win_amd64.pyd +0 -0
  597. sqlspec/utils/schema.py +1040 -0
  598. sqlspec/utils/serializers/__init__.py +30 -0
  599. sqlspec/utils/serializers/_json.cp314-win_amd64.pyd +0 -0
  600. sqlspec/utils/serializers/_json.py +415 -0
  601. sqlspec/utils/serializers/_numpy.cp314-win_amd64.pyd +0 -0
  602. sqlspec/utils/serializers/_numpy.py +65 -0
  603. sqlspec/utils/serializers/_schema.cp314-win_amd64.pyd +0 -0
  604. sqlspec/utils/serializers/_schema.py +285 -0
  605. sqlspec/utils/singleton.cp314-win_amd64.pyd +0 -0
  606. sqlspec/utils/singleton.py +41 -0
  607. sqlspec/utils/sync_tools.cp314-win_amd64.pyd +0 -0
  608. sqlspec/utils/sync_tools.py +316 -0
  609. sqlspec/utils/text.cp314-win_amd64.pyd +0 -0
  610. sqlspec/utils/text.py +109 -0
  611. sqlspec/utils/type_converters.cp314-win_amd64.pyd +0 -0
  612. sqlspec/utils/type_converters.py +216 -0
  613. sqlspec/utils/type_guards.cp314-win_amd64.pyd +0 -0
  614. sqlspec/utils/type_guards.py +1508 -0
  615. sqlspec/utils/uuids.cp314-win_amd64.pyd +0 -0
  616. sqlspec/utils/uuids.py +241 -0
  617. sqlspec-0.47.0.dist-info/METADATA +202 -0
  618. sqlspec-0.47.0.dist-info/RECORD +621 -0
  619. sqlspec-0.47.0.dist-info/WHEEL +4 -0
  620. sqlspec-0.47.0.dist-info/entry_points.txt +6 -0
  621. sqlspec-0.47.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,364 @@
1
+ """Configuration objects for the observability suite."""
2
+
3
+ from collections.abc import Callable, Iterable
4
+ from typing import TYPE_CHECKING, Any, Protocol, cast
5
+
6
+ if TYPE_CHECKING: # pragma: no cover - import cycle guard
7
+ from sqlspec.config import LifecycleConfig
8
+ from sqlspec.observability._formatters._base import CloudLogFormatter
9
+ from sqlspec.observability._observer import StatementEvent
10
+ from sqlspec.observability._sampling import SamplingConfig
11
+
12
+ __all__ = (
13
+ "LifecycleHook",
14
+ "LoggingConfig",
15
+ "ObservabilityConfig",
16
+ "RedactionConfig",
17
+ "StatementObserver",
18
+ "TelemetryConfig",
19
+ )
20
+
21
+ LifecycleHook = Callable[[dict[str, Any]], None]
22
+
23
+
24
+ class StatementObserver(Protocol):
25
+ """Protocol for callbacks that receive SQL execution events."""
26
+
27
+ def __call__(self, event: "StatementEvent", /) -> None:
28
+ """Handle a SQL execution event."""
29
+ ...
30
+
31
+
32
+ class RedactionConfig:
33
+ """Controls SQL and parameter redaction before observers run."""
34
+
35
+ __slots__ = ("mask_literals", "mask_parameters", "parameter_allow_list")
36
+
37
+ def __init__(
38
+ self,
39
+ *,
40
+ mask_parameters: bool | None = None,
41
+ mask_literals: bool | None = None,
42
+ parameter_allow_list: tuple[str, ...] | Iterable[str] | None = None,
43
+ ) -> None:
44
+ self.mask_parameters = mask_parameters
45
+ self.mask_literals = mask_literals
46
+ self.parameter_allow_list = tuple(parameter_allow_list) if parameter_allow_list is not None else None
47
+
48
+ def __hash__(self) -> int: # pragma: no cover - explicit to mirror dataclass behavior
49
+ msg = "RedactionConfig objects are mutable and unhashable"
50
+ raise TypeError(msg)
51
+
52
+ def copy(self) -> "RedactionConfig":
53
+ """Return a copy to avoid sharing mutable state."""
54
+
55
+ allow_list = tuple(self.parameter_allow_list) if self.parameter_allow_list else None
56
+ return RedactionConfig(
57
+ mask_parameters=self.mask_parameters, mask_literals=self.mask_literals, parameter_allow_list=allow_list
58
+ )
59
+
60
+ def __repr__(self) -> str:
61
+ return f"RedactionConfig(mask_parameters={self.mask_parameters!r}, mask_literals={self.mask_literals!r}, parameter_allow_list={self.parameter_allow_list!r})"
62
+
63
+ def __eq__(self, other: object) -> bool:
64
+ if not isinstance(other, RedactionConfig):
65
+ return NotImplemented
66
+ return (
67
+ self.mask_parameters == other.mask_parameters
68
+ and self.mask_literals == other.mask_literals
69
+ and self.parameter_allow_list == other.parameter_allow_list
70
+ )
71
+
72
+
73
+ class TelemetryConfig:
74
+ """Span emission and tracer provider settings."""
75
+
76
+ __slots__ = ("enable_spans", "provider_factory", "resource_attributes")
77
+
78
+ def __init__(
79
+ self,
80
+ *,
81
+ enable_spans: bool = False,
82
+ provider_factory: Callable[[], Any] | None = None,
83
+ resource_attributes: dict[str, Any] | None = None,
84
+ ) -> None:
85
+ self.enable_spans = enable_spans
86
+ self.provider_factory = provider_factory
87
+ self.resource_attributes = dict(resource_attributes) if resource_attributes else None
88
+
89
+ def __hash__(self) -> int: # pragma: no cover - explicit to mirror dataclass behavior
90
+ msg = "TelemetryConfig objects are mutable and unhashable"
91
+ raise TypeError(msg)
92
+
93
+ def copy(self) -> "TelemetryConfig":
94
+ """Return a shallow copy preserving optional dictionaries."""
95
+
96
+ attributes = dict(self.resource_attributes) if self.resource_attributes else None
97
+ return TelemetryConfig(
98
+ enable_spans=self.enable_spans, provider_factory=self.provider_factory, resource_attributes=attributes
99
+ )
100
+
101
+ def __repr__(self) -> str:
102
+ return f"TelemetryConfig(enable_spans={self.enable_spans!r}, provider_factory={self.provider_factory!r}, resource_attributes={self.resource_attributes!r})"
103
+
104
+ def __eq__(self, other: object) -> bool:
105
+ if not isinstance(other, TelemetryConfig):
106
+ return NotImplemented
107
+ return (
108
+ self.enable_spans == other.enable_spans
109
+ and self.provider_factory == other.provider_factory
110
+ and self.resource_attributes == other.resource_attributes
111
+ )
112
+
113
+
114
+ class LoggingConfig:
115
+ """Controls log output format and verbosity."""
116
+
117
+ __slots__ = (
118
+ "include_driver_name",
119
+ "include_sql_hash",
120
+ "include_trace_context",
121
+ "parameter_truncation_count",
122
+ "sql_truncation_length",
123
+ )
124
+
125
+ def __init__(
126
+ self,
127
+ *,
128
+ include_sql_hash: bool = True,
129
+ sql_truncation_length: int = 2000,
130
+ parameter_truncation_count: int = 100,
131
+ include_trace_context: bool = True,
132
+ include_driver_name: bool = False,
133
+ ) -> None:
134
+ self.include_sql_hash = include_sql_hash
135
+ self.sql_truncation_length = sql_truncation_length
136
+ self.parameter_truncation_count = parameter_truncation_count
137
+ self.include_trace_context = include_trace_context
138
+ self.include_driver_name = include_driver_name
139
+
140
+ def __hash__(self) -> int: # pragma: no cover - explicit to mirror dataclass behavior
141
+ msg = "LoggingConfig objects are mutable and unhashable"
142
+ raise TypeError(msg)
143
+
144
+ def copy(self) -> "LoggingConfig":
145
+ """Return a shallow copy of the logging configuration."""
146
+
147
+ return LoggingConfig(
148
+ include_sql_hash=self.include_sql_hash,
149
+ sql_truncation_length=self.sql_truncation_length,
150
+ parameter_truncation_count=self.parameter_truncation_count,
151
+ include_trace_context=self.include_trace_context,
152
+ include_driver_name=self.include_driver_name,
153
+ )
154
+
155
+ def __repr__(self) -> str:
156
+ return (
157
+ f"LoggingConfig(include_sql_hash={self.include_sql_hash!r}, sql_truncation_length={self.sql_truncation_length!r}, "
158
+ f"parameter_truncation_count={self.parameter_truncation_count!r}, include_trace_context={self.include_trace_context!r}, "
159
+ f"include_driver_name={self.include_driver_name!r})"
160
+ )
161
+
162
+ def __eq__(self, other: object) -> bool:
163
+ if not isinstance(other, LoggingConfig):
164
+ return NotImplemented
165
+ return (
166
+ self.include_sql_hash == other.include_sql_hash
167
+ and self.sql_truncation_length == other.sql_truncation_length
168
+ and self.parameter_truncation_count == other.parameter_truncation_count
169
+ and self.include_trace_context == other.include_trace_context
170
+ and self.include_driver_name == other.include_driver_name
171
+ )
172
+
173
+
174
+ class ObservabilityConfig:
175
+ """Aggregates lifecycle hooks, observers, and telemetry toggles."""
176
+
177
+ __slots__ = (
178
+ "cloud_formatter",
179
+ "lifecycle",
180
+ "logging",
181
+ "print_sql",
182
+ "redaction",
183
+ "sampling",
184
+ "statement_observers",
185
+ "telemetry",
186
+ )
187
+
188
+ def __init__(
189
+ self,
190
+ *,
191
+ lifecycle: "LifecycleConfig | None" = None,
192
+ print_sql: bool | None = None,
193
+ statement_observers: tuple[StatementObserver, ...] | Iterable[StatementObserver] | None = None,
194
+ telemetry: "TelemetryConfig | None" = None,
195
+ redaction: "RedactionConfig | None" = None,
196
+ logging: "LoggingConfig | None" = None,
197
+ sampling: "SamplingConfig | None" = None,
198
+ cloud_formatter: "CloudLogFormatter | None" = None,
199
+ ) -> None:
200
+ self.lifecycle = lifecycle
201
+ self.print_sql = print_sql
202
+ self.statement_observers = tuple(statement_observers) if statement_observers is not None else None
203
+ self.telemetry = telemetry
204
+ self.redaction = redaction
205
+ self.logging = logging
206
+ self.sampling = sampling
207
+ self.cloud_formatter = cloud_formatter
208
+
209
+ def __hash__(self) -> int: # pragma: no cover - explicit to mirror dataclass behavior
210
+ msg = "ObservabilityConfig objects are mutable and unhashable"
211
+ raise TypeError(msg)
212
+
213
+ def copy(self) -> "ObservabilityConfig":
214
+ """Return a deep copy of the configuration."""
215
+
216
+ lifecycle_copy = _normalize_lifecycle(self.lifecycle)
217
+ observers = tuple(self.statement_observers) if self.statement_observers else None
218
+ telemetry_copy = self.telemetry.copy() if self.telemetry else None
219
+ redaction_copy = self.redaction.copy() if self.redaction else None
220
+ logging_copy = self.logging.copy() if self.logging else None
221
+ sampling_copy = self.sampling.copy() if self.sampling else None
222
+ return ObservabilityConfig(
223
+ lifecycle=lifecycle_copy,
224
+ print_sql=self.print_sql,
225
+ statement_observers=observers,
226
+ telemetry=telemetry_copy,
227
+ redaction=redaction_copy,
228
+ logging=logging_copy,
229
+ sampling=sampling_copy,
230
+ cloud_formatter=self.cloud_formatter,
231
+ )
232
+
233
+ @classmethod
234
+ def merge(
235
+ cls, base_config: "ObservabilityConfig | None", override_config: "ObservabilityConfig | None"
236
+ ) -> "ObservabilityConfig":
237
+ """Merge registry-level and adapter-level configuration objects."""
238
+
239
+ if base_config is None and override_config is None:
240
+ return cls()
241
+
242
+ base = base_config.copy() if base_config else cls()
243
+ override = override_config
244
+ if override is None:
245
+ return base
246
+
247
+ lifecycle = _merge_lifecycle(base.lifecycle, override.lifecycle)
248
+ observers: tuple[StatementObserver, ...] | None
249
+ if base.statement_observers and override.statement_observers:
250
+ observers = base.statement_observers + tuple(override.statement_observers)
251
+ elif override.statement_observers:
252
+ observers = tuple(override.statement_observers)
253
+ else:
254
+ observers = base.statement_observers
255
+
256
+ print_sql = base.print_sql
257
+ if override.print_sql is not None:
258
+ print_sql = override.print_sql
259
+
260
+ telemetry = override.telemetry.copy() if override.telemetry else base.telemetry
261
+ redaction = _merge_redaction(base.redaction, override.redaction)
262
+ logging = _merge_logging(base.logging, override.logging)
263
+ sampling = _merge_sampling(base.sampling, override.sampling)
264
+ cloud_formatter = override.cloud_formatter if override.cloud_formatter is not None else base.cloud_formatter
265
+
266
+ return ObservabilityConfig(
267
+ lifecycle=lifecycle,
268
+ print_sql=print_sql,
269
+ statement_observers=observers,
270
+ telemetry=telemetry,
271
+ redaction=redaction,
272
+ logging=logging,
273
+ sampling=sampling,
274
+ cloud_formatter=cloud_formatter,
275
+ )
276
+
277
+ def __repr__(self) -> str:
278
+ return (
279
+ f"ObservabilityConfig(lifecycle={self.lifecycle!r}, print_sql={self.print_sql!r}, statement_observers={self.statement_observers!r}, telemetry={self.telemetry!r}, "
280
+ f"redaction={self.redaction!r}, logging={self.logging!r}, sampling={self.sampling!r}, cloud_formatter={self.cloud_formatter!r})"
281
+ )
282
+
283
+ def __eq__(self, other: object) -> bool:
284
+ if not isinstance(other, ObservabilityConfig):
285
+ return NotImplemented
286
+ return (
287
+ _normalize_lifecycle(self.lifecycle) == _normalize_lifecycle(other.lifecycle)
288
+ and self.print_sql == other.print_sql
289
+ and self.statement_observers == other.statement_observers
290
+ and self.telemetry == other.telemetry
291
+ and self.redaction == other.redaction
292
+ and self.logging == other.logging
293
+ and self.sampling == other.sampling
294
+ and self.cloud_formatter == other.cloud_formatter
295
+ )
296
+
297
+
298
+ def _merge_redaction(base: "RedactionConfig | None", override: "RedactionConfig | None") -> "RedactionConfig | None":
299
+ if base is None and override is None:
300
+ return None
301
+ if override is None:
302
+ return base.copy() if base else None
303
+ if base is None:
304
+ return override.copy()
305
+ merged = base.copy()
306
+ if override.mask_parameters is not None:
307
+ merged.mask_parameters = override.mask_parameters
308
+ if override.mask_literals is not None:
309
+ merged.mask_literals = override.mask_literals
310
+ if override.parameter_allow_list is not None:
311
+ merged.parameter_allow_list = tuple(override.parameter_allow_list)
312
+ return merged
313
+
314
+
315
+ def _merge_logging(base: "LoggingConfig | None", override: "LoggingConfig | None") -> "LoggingConfig | None":
316
+ if base is None and override is None:
317
+ return None
318
+ if override is None:
319
+ return base.copy() if base else None
320
+ return override.copy()
321
+
322
+
323
+ def _merge_sampling(base: "SamplingConfig | None", override: "SamplingConfig | None") -> "SamplingConfig | None":
324
+ if base is None and override is None:
325
+ return None
326
+ if override is None:
327
+ return base.copy() if base else None
328
+ if base is None:
329
+ return override.copy()
330
+ merged = base.copy()
331
+ if override.sample_rate != 1.0:
332
+ merged.sample_rate = override.sample_rate
333
+ if override.deterministic:
334
+ merged.deterministic = override.deterministic
335
+ if override.force_sample_on_error:
336
+ merged.force_sample_on_error = override.force_sample_on_error
337
+ if override.force_sample_slow_queries_ms is not None:
338
+ merged.force_sample_slow_queries_ms = override.force_sample_slow_queries_ms
339
+ return merged
340
+
341
+
342
+ def _normalize_lifecycle(config: "LifecycleConfig | None") -> "LifecycleConfig | None":
343
+ if config is None:
344
+ return None
345
+ normalized: dict[str, list[LifecycleHook]] = {}
346
+ for event, hooks in config.items():
347
+ normalized[event] = list(cast("Iterable[LifecycleHook]", hooks))
348
+ return cast("LifecycleConfig", normalized)
349
+
350
+
351
+ def _merge_lifecycle(base: "LifecycleConfig | None", override: "LifecycleConfig | None") -> "LifecycleConfig | None":
352
+ if base is None and override is None:
353
+ return None
354
+ if base is None:
355
+ return _normalize_lifecycle(override)
356
+ if override is None:
357
+ return _normalize_lifecycle(base)
358
+ merged_dict: dict[str, list[LifecycleHook]] = (
359
+ cast("dict[str, list[LifecycleHook]]", _normalize_lifecycle(base)) or {}
360
+ )
361
+ for event, hooks in override.items():
362
+ merged_dict.setdefault(event, [])
363
+ merged_dict[event].extend(cast("Iterable[LifecycleHook]", hooks))
364
+ return cast("LifecycleConfig", merged_dict)
@@ -0,0 +1,74 @@
1
+ """Diagnostics aggregation utilities for observability exports."""
2
+
3
+ from collections.abc import Iterable
4
+
5
+ from sqlspec.storage.pipeline import (
6
+ StorageDiagnostics,
7
+ StorageTelemetry,
8
+ get_recent_storage_events,
9
+ get_storage_bridge_diagnostics,
10
+ )
11
+
12
+ __all__ = ("DiagnosticsPayload", "TelemetryDiagnostics", "collect_diagnostics")
13
+
14
+
15
+ DiagnosticsPayload = dict[str, float | list[StorageTelemetry]]
16
+
17
+
18
+ def _increment_metric(payload: "dict[str, float]", metric: str, amount: float) -> None:
19
+ payload[metric] = payload.get(metric, 0.0) + amount
20
+
21
+
22
+ class TelemetryDiagnostics:
23
+ """Aggregates lifecycle counters, custom metrics, and storage telemetry."""
24
+
25
+ __slots__ = ("_lifecycle_sections", "_metrics")
26
+
27
+ def __init__(self) -> None:
28
+ self._lifecycle_sections: list[tuple[str, dict[str, float]]] = []
29
+ self._metrics: StorageDiagnostics = {}
30
+
31
+ def add_lifecycle_snapshot(self, config_key: str, counters: dict[str, int]) -> None:
32
+ """Store lifecycle counters for later snapshot generation."""
33
+
34
+ if not counters:
35
+ return
36
+ float_counters = {metric: float(value) for metric, value in counters.items()}
37
+ self._lifecycle_sections.append((config_key, float_counters))
38
+
39
+ def add_metric_snapshot(self, metrics: StorageDiagnostics) -> None:
40
+ """Store custom metric snapshots."""
41
+
42
+ for key, value in metrics.items():
43
+ if key in self._metrics:
44
+ self._metrics[key] += value
45
+ else:
46
+ self._metrics[key] = value
47
+
48
+ def snapshot(self) -> "DiagnosticsPayload":
49
+ """Return aggregated diagnostics payload."""
50
+
51
+ numeric_payload: dict[str, float] = {}
52
+
53
+ for key, value in get_storage_bridge_diagnostics().items():
54
+ _increment_metric(numeric_payload, key, float(value))
55
+ for _prefix, counters in self._lifecycle_sections:
56
+ for metric, value in counters.items():
57
+ _increment_metric(numeric_payload, metric, value)
58
+ for metric, value in self._metrics.items():
59
+ _increment_metric(numeric_payload, metric, float(value))
60
+
61
+ payload: DiagnosticsPayload = dict(numeric_payload)
62
+ recent_jobs = get_recent_storage_events()
63
+ if recent_jobs:
64
+ payload["storage_bridge.recent_jobs"] = recent_jobs
65
+ return payload
66
+
67
+
68
+ def collect_diagnostics(sections: Iterable[tuple[str, dict[str, int]]]) -> DiagnosticsPayload:
69
+ """Convenience helper for aggregating sections without constructing a class."""
70
+
71
+ diag = TelemetryDiagnostics()
72
+ for prefix, counters in sections:
73
+ diag.add_lifecycle_snapshot(prefix, counters)
74
+ return diag.snapshot()
@@ -0,0 +1,200 @@
1
+ """Lifecycle dispatcher used by drivers and registry hooks."""
2
+
3
+ import asyncio
4
+ from collections.abc import Callable, Iterable
5
+ from typing import Any, Literal
6
+
7
+ from sqlspec.utils.logging import get_logger
8
+
9
+ __all__ = ("LifecycleContext", "LifecycleDispatcher", "LifecycleHook")
10
+
11
+
12
+ logger = get_logger("sqlspec.observability.lifecycle")
13
+
14
+ LifecycleContext = dict[str, Any]
15
+ LifecycleHook = Callable[[LifecycleContext], Any]
16
+
17
+ LifecycleEvent = Literal[
18
+ "on_pool_create",
19
+ "on_pool_destroying",
20
+ "on_pool_destroy",
21
+ "on_connection_create",
22
+ "on_connection_destroy",
23
+ "on_session_start",
24
+ "on_session_end",
25
+ "on_query_start",
26
+ "on_query_complete",
27
+ "on_error",
28
+ ]
29
+ EVENT_ATTRS: tuple[LifecycleEvent, ...] = (
30
+ "on_pool_create",
31
+ "on_pool_destroying",
32
+ "on_pool_destroy",
33
+ "on_connection_create",
34
+ "on_connection_destroy",
35
+ "on_session_start",
36
+ "on_session_end",
37
+ "on_query_start",
38
+ "on_query_complete",
39
+ "on_error",
40
+ )
41
+ GUARD_ATTRS = tuple(f"has_{name[3:]}" for name in EVENT_ATTRS)
42
+
43
+
44
+ class LifecycleDispatcher:
45
+ """Dispatches lifecycle hooks with guard flags and diagnostics counters."""
46
+
47
+ __slots__ = (
48
+ "_counters",
49
+ "_hooks",
50
+ "_is_enabled",
51
+ "has_connection_create",
52
+ "has_connection_destroy",
53
+ "has_error",
54
+ "has_pool_create",
55
+ "has_pool_destroy",
56
+ "has_pool_destroying",
57
+ "has_query_complete",
58
+ "has_query_start",
59
+ "has_session_end",
60
+ "has_session_start",
61
+ )
62
+
63
+ def __init__(self, hooks: "dict[str, Iterable[LifecycleHook]] | None" = None) -> None:
64
+ self.has_pool_create = False
65
+ self.has_pool_destroying = False
66
+ self.has_pool_destroy = False
67
+ self.has_connection_create = False
68
+ self.has_connection_destroy = False
69
+ self.has_session_start = False
70
+ self.has_session_end = False
71
+ self.has_query_start = False
72
+ self.has_query_complete = False
73
+ self.has_error = False
74
+
75
+ normalized: dict[LifecycleEvent, list[LifecycleHook]] = {}
76
+ for event_name, guard_attr in zip(EVENT_ATTRS, GUARD_ATTRS, strict=False):
77
+ callables = hooks.get(event_name) if hooks else None
78
+ normalized[event_name] = list(callables) if callables else []
79
+ setattr(self, guard_attr, bool(normalized[event_name]))
80
+ self._hooks: dict[LifecycleEvent, list[LifecycleHook]] = normalized
81
+ self._counters: dict[LifecycleEvent, int] = dict.fromkeys(EVENT_ATTRS, 0)
82
+ self._is_enabled = any(self._hooks.values())
83
+
84
+ @property
85
+ def is_enabled(self) -> bool:
86
+ """Return True when at least one hook is registered."""
87
+
88
+ return self._is_enabled
89
+
90
+ def emit_pool_create(self, context: "LifecycleContext") -> None:
91
+ """Fire pool creation hooks."""
92
+
93
+ self._emit("on_pool_create", context)
94
+
95
+ def emit_pool_destroying_sync(self, context: "LifecycleContext") -> None:
96
+ """Fire pre-destruction hooks synchronously (sync close path).
97
+
98
+ Returned awaitables are discarded; callers in the async path must use
99
+ ``emit_pool_destroying_async`` to await async teardown work.
100
+ """
101
+
102
+ self._emit("on_pool_destroying", context)
103
+
104
+ async def emit_pool_destroying_async(self, context: "LifecycleContext") -> None:
105
+ """Fire pre-destruction hooks, awaiting any awaitable return values."""
106
+
107
+ callbacks = self._hooks.get("on_pool_destroying")
108
+ if not callbacks:
109
+ return
110
+ self._counters["on_pool_destroying"] += 1
111
+ for callback in list(callbacks):
112
+ try:
113
+ result = callback(context)
114
+ except Exception as exc: # pragma: no cover - defensive logging
115
+ logger.warning("Lifecycle hook failed: event=on_pool_destroying error=%s", exc)
116
+ continue
117
+ if asyncio.iscoroutine(result):
118
+ try:
119
+ await result
120
+ except Exception as exc: # pragma: no cover - defensive logging
121
+ logger.warning("Lifecycle hook failed: event=on_pool_destroying error=%s", exc)
122
+
123
+ def register_hook(self, event: LifecycleEvent, callback: LifecycleHook) -> None:
124
+ """Append a hook at runtime.
125
+
126
+ Used by components (e.g., persistent event listener hubs) that must register
127
+ teardown work after the config has already been constructed.
128
+ """
129
+
130
+ callbacks = self._hooks.setdefault(event, [])
131
+ callbacks.append(callback)
132
+ guard_attr = f"has_{event[3:]}"
133
+ setattr(self, guard_attr, True)
134
+ self._is_enabled = True
135
+
136
+ def emit_pool_destroy(self, context: "LifecycleContext") -> None:
137
+ """Fire pool destruction hooks."""
138
+
139
+ self._emit("on_pool_destroy", context)
140
+
141
+ def emit_connection_create(self, context: "LifecycleContext") -> None:
142
+ """Fire connection creation hooks."""
143
+
144
+ self._emit("on_connection_create", context)
145
+
146
+ def emit_connection_destroy(self, context: "LifecycleContext") -> None:
147
+ """Fire connection teardown hooks."""
148
+
149
+ self._emit("on_connection_destroy", context)
150
+
151
+ def emit_session_start(self, context: "LifecycleContext") -> None:
152
+ """Fire session start hooks."""
153
+
154
+ self._emit("on_session_start", context)
155
+
156
+ def emit_session_end(self, context: "LifecycleContext") -> None:
157
+ """Fire session end hooks."""
158
+
159
+ self._emit("on_session_end", context)
160
+
161
+ def emit_query_start(self, context: "LifecycleContext") -> None:
162
+ """Fire query start hooks."""
163
+
164
+ self._emit("on_query_start", context)
165
+
166
+ def emit_query_complete(self, context: "LifecycleContext") -> None:
167
+ """Fire query completion hooks."""
168
+
169
+ self._emit("on_query_complete", context)
170
+
171
+ def emit_error(self, context: "LifecycleContext") -> None:
172
+ """Fire error hooks with failure context."""
173
+
174
+ self._emit("on_error", context)
175
+
176
+ def snapshot(self, *, prefix: str | None = None) -> "dict[str, int]":
177
+ """Return counter snapshot keyed for diagnostics export."""
178
+
179
+ metrics: dict[str, int] = {}
180
+ for event_name, count in self._counters.items():
181
+ key = event_name.replace("on_", "lifecycle.")
182
+ if prefix:
183
+ key = f"{prefix}.{key}"
184
+ metrics[key] = count
185
+ return metrics
186
+
187
+ def _emit(self, event: LifecycleEvent, context: "LifecycleContext") -> None:
188
+ callbacks = self._hooks.get(event)
189
+ if not callbacks:
190
+ return
191
+ self._counters[event] += 1
192
+ for callback in callbacks:
193
+ self._invoke_callback(callback, context, event)
194
+
195
+ @staticmethod
196
+ def _invoke_callback(callback: LifecycleHook, context: "LifecycleContext", event: LifecycleEvent) -> None:
197
+ try:
198
+ callback(context)
199
+ except Exception as exc: # pragma: no cover - defensive logging
200
+ logger.warning("Lifecycle hook failed: event=%s error=%s", event, exc)
@@ -0,0 +1,13 @@
1
+ """Cloud log formatters for observability.
2
+
3
+ This module provides cloud-specific log formatters for GCP, AWS, and Azure
4
+ that produce structured JSON output compatible with each provider's logging
5
+ requirements.
6
+ """
7
+
8
+ from sqlspec.observability._formatters._aws import AWSLogFormatter
9
+ from sqlspec.observability._formatters._azure import AzureLogFormatter
10
+ from sqlspec.observability._formatters._base import CloudLogFormatter
11
+ from sqlspec.observability._formatters._gcp import GCPLogFormatter
12
+
13
+ __all__ = ("AWSLogFormatter", "AzureLogFormatter", "CloudLogFormatter", "GCPLogFormatter")