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,525 @@
1
+ """Base store classes for ADK memory backend (sync and async)."""
2
+
3
+ import logging
4
+ import re
5
+ from abc import ABC, abstractmethod
6
+ from typing import TYPE_CHECKING, Any, Final, Generic, TypeVar
7
+
8
+ from sqlspec.extensions.adk._config_utils import _ADKMemoryStoreConfig, _get_adk_memory_store_config
9
+ from sqlspec.observability import resolve_db_system
10
+ from sqlspec.utils.logging import get_logger, log_with_context
11
+
12
+ if TYPE_CHECKING:
13
+ from sqlspec.config import DatabaseConfigProtocol
14
+ from sqlspec.extensions.adk.memory._types import MemoryRecord
15
+
16
+ ConfigT = TypeVar("ConfigT", bound="DatabaseConfigProtocol[Any, Any, Any]")
17
+
18
+ logger = get_logger("sqlspec.extensions.adk.memory.store")
19
+
20
+ __all__ = ("BaseAsyncADKMemoryStore", "BaseSyncADKMemoryStore")
21
+
22
+ VALID_TABLE_NAME_PATTERN: Final = re.compile(r"^[a-zA-Z_][a-zA-Z0-9_]*$")
23
+ COLUMN_NAME_PATTERN: Final = re.compile(r"^(\w+)")
24
+ MAX_TABLE_NAME_LENGTH: Final = 63
25
+
26
+
27
+ def _parse_owner_id_column(owner_id_column_ddl: str) -> str:
28
+ """Extract column name from owner ID column DDL definition.
29
+
30
+ Args:
31
+ owner_id_column_ddl: Full column DDL string.
32
+
33
+ Returns:
34
+ Column name only (first word).
35
+
36
+ Raises:
37
+ ValueError: If DDL format is invalid.
38
+ """
39
+ match = COLUMN_NAME_PATTERN.match(owner_id_column_ddl.strip())
40
+ if not match:
41
+ msg = f"Invalid owner_id_column DDL: {owner_id_column_ddl!r}. Must start with column name."
42
+ raise ValueError(msg)
43
+
44
+ return match.group(1)
45
+
46
+
47
+ def _validate_table_name(table_name: str) -> None:
48
+ """Validate table name for SQL safety.
49
+
50
+ Args:
51
+ table_name: Table name to validate.
52
+
53
+ Raises:
54
+ ValueError: If table name is invalid.
55
+ """
56
+ if not table_name:
57
+ msg = "Table name cannot be empty"
58
+ raise ValueError(msg)
59
+
60
+ if len(table_name) > MAX_TABLE_NAME_LENGTH:
61
+ msg = f"Table name too long: {len(table_name)} chars (max {MAX_TABLE_NAME_LENGTH})"
62
+ raise ValueError(msg)
63
+
64
+ if not VALID_TABLE_NAME_PATTERN.match(table_name):
65
+ msg = (
66
+ f"Invalid table name: {table_name!r}. "
67
+ "Must start with letter/underscore and contain only alphanumeric characters and underscores"
68
+ )
69
+ raise ValueError(msg)
70
+
71
+
72
+ class BaseAsyncADKMemoryStore(ABC, Generic[ConfigT]):
73
+ """Base class for async SQLSpec-backed ADK memory stores.
74
+
75
+ Implements storage operations for Google ADK memory entries using
76
+ SQLSpec database adapters with async/await.
77
+
78
+ This abstract base class provides common functionality for all database-specific
79
+ memory store implementations including:
80
+ - Connection management via SQLSpec configs
81
+ - Table name validation
82
+ - Memory entry CRUD operations
83
+ - Text search with optional full-text search support
84
+
85
+ Subclasses must implement dialect-specific SQL queries and will be created
86
+ in each adapter directory (e.g., sqlspec/adapters/asyncpg/adk/store.py).
87
+
88
+ Args:
89
+ config: SQLSpec database configuration with extension_config["adk"] settings.
90
+
91
+ Notes:
92
+ Configuration is read from config.extension_config["adk"]:
93
+ - memory_table: Memory table name (default: "adk_memory_entries")
94
+ - memory_use_fts: Enable full-text search when supported (default: False)
95
+ - memory_max_results: Max search results (default: 20)
96
+ - owner_id_column: Optional owner FK column DDL (default: None)
97
+ - enable_memory: Whether memory is enabled (default: True)
98
+ """
99
+
100
+ __slots__ = (
101
+ "_config",
102
+ "_enabled",
103
+ "_max_results",
104
+ "_memory_table",
105
+ "_owner_id_column_ddl",
106
+ "_owner_id_column_name",
107
+ "_use_fts",
108
+ )
109
+
110
+ def __init__(self, config: ConfigT) -> None:
111
+ """Initialize the ADK memory store.
112
+
113
+ Args:
114
+ config: SQLSpec database configuration.
115
+
116
+ Notes:
117
+ Reads configuration from config.extension_config["adk"]:
118
+ - memory_table: Memory table name (default: "adk_memory_entries")
119
+ - memory_use_fts: Enable full-text search when supported (default: False)
120
+ - memory_max_results: Max search results (default: 20)
121
+ - owner_id_column: Optional owner FK column DDL (default: None)
122
+ - enable_memory: Whether memory is enabled (default: True)
123
+ """
124
+ self._config = config
125
+ store_config = self._get_store_config_from_extension()
126
+ self._enabled: bool = store_config.get("enable_memory", True)
127
+ self._memory_table: str = str(store_config["memory_table"])
128
+ self._use_fts: bool = bool(store_config.get("use_fts", False))
129
+ self._max_results: int = store_config.get("max_results", 20)
130
+ self._owner_id_column_ddl: str | None = store_config.get("owner_id_column")
131
+ self._owner_id_column_name: str | None = (
132
+ _parse_owner_id_column(self._owner_id_column_ddl) if self._owner_id_column_ddl else None
133
+ )
134
+ _validate_table_name(self._memory_table)
135
+
136
+ def _get_store_config_from_extension(self) -> "_ADKMemoryStoreConfig":
137
+ """Extract ADK memory configuration from config.extension_config.
138
+
139
+ Returns:
140
+ Dict with memory_table, use_fts, max_results, and optionally owner_id_column.
141
+ """
142
+ return _get_adk_memory_store_config(self._config)
143
+
144
+ @property
145
+ def config(self) -> ConfigT:
146
+ """Return the database configuration."""
147
+ return self._config
148
+
149
+ @property
150
+ def memory_table(self) -> str:
151
+ """Return the memory table name."""
152
+ return self._memory_table
153
+
154
+ @property
155
+ def enabled(self) -> bool:
156
+ """Return whether memory store is enabled."""
157
+ return self._enabled
158
+
159
+ @property
160
+ def use_fts(self) -> bool:
161
+ """Return whether full-text search is enabled."""
162
+ return self._use_fts
163
+
164
+ @property
165
+ def max_results(self) -> int:
166
+ """Return the max search results limit."""
167
+ return self._max_results
168
+
169
+ @property
170
+ def owner_id_column_ddl(self) -> "str | None":
171
+ """Return the full owner ID column DDL (or None if not configured)."""
172
+ return self._owner_id_column_ddl
173
+
174
+ @property
175
+ def owner_id_column_name(self) -> "str | None":
176
+ """Return the owner ID column name only (or None if not configured)."""
177
+ return self._owner_id_column_name
178
+
179
+ @abstractmethod
180
+ async def create_tables(self) -> None:
181
+ """Create the memory table and indexes if they don't exist.
182
+
183
+ Should check self._enabled and skip table creation if False.
184
+ """
185
+ raise NotImplementedError
186
+
187
+ async def ensure_tables(self) -> None:
188
+ """Create tables when enabled and emit a standardized log entry."""
189
+
190
+ if not self._enabled:
191
+ self._log_memory_table_skipped()
192
+ return
193
+ await self.create_tables()
194
+ self._log_memory_table_created()
195
+
196
+ @abstractmethod
197
+ async def insert_memory_entries(self, entries: "list[MemoryRecord]", owner_id: "object | None" = None) -> int:
198
+ """Bulk insert memory entries with deduplication.
199
+
200
+ Uses UPSERT pattern to skip duplicates based on event_id.
201
+
202
+ Args:
203
+ entries: List of memory records to insert.
204
+ owner_id: Optional owner ID value for owner_id_column (if configured).
205
+
206
+ Returns:
207
+ Number of entries actually inserted (excludes duplicates).
208
+
209
+ Raises:
210
+ RuntimeError: If memory store is disabled.
211
+ """
212
+ raise NotImplementedError
213
+
214
+ def _log_memory_table_created(self) -> None:
215
+ log_with_context(
216
+ logger,
217
+ logging.DEBUG,
218
+ "adk.memory.table.ready",
219
+ db_system=resolve_db_system(type(self).__name__),
220
+ memory_table=self._memory_table,
221
+ )
222
+
223
+ def _log_memory_table_skipped(self) -> None:
224
+ log_with_context(
225
+ logger,
226
+ logging.DEBUG,
227
+ "adk.memory.table.skipped",
228
+ db_system=resolve_db_system(type(self).__name__),
229
+ memory_table=self._memory_table,
230
+ reason="disabled",
231
+ )
232
+
233
+ @abstractmethod
234
+ async def search_entries(
235
+ self, query: str, app_name: str, user_id: str, limit: "int | None" = None
236
+ ) -> "list[MemoryRecord]":
237
+ """Search memory entries by text query.
238
+
239
+ Uses the configured search strategy (simple ILIKE or FTS).
240
+
241
+ Args:
242
+ query: Text query to search for.
243
+ app_name: Application name to filter by.
244
+ user_id: User ID to filter by.
245
+ limit: Maximum number of results (defaults to max_results config).
246
+
247
+ Returns:
248
+ List of matching memory records ordered by relevance/timestamp.
249
+
250
+ Raises:
251
+ RuntimeError: If memory store is disabled.
252
+ """
253
+ raise NotImplementedError
254
+
255
+ @abstractmethod
256
+ async def delete_entries_by_session(self, session_id: str) -> int:
257
+ """Delete all memory entries for a specific session.
258
+
259
+ Args:
260
+ session_id: Session ID to delete entries for.
261
+
262
+ Returns:
263
+ Number of entries deleted.
264
+ """
265
+ raise NotImplementedError
266
+
267
+ @abstractmethod
268
+ async def delete_entries_older_than(self, days: int) -> int:
269
+ """Delete memory entries older than specified days.
270
+
271
+ Used for TTL cleanup operations.
272
+
273
+ Args:
274
+ days: Number of days to retain entries.
275
+
276
+ Returns:
277
+ Number of entries deleted.
278
+ """
279
+ raise NotImplementedError
280
+
281
+ @abstractmethod
282
+ async def _get_create_memory_table_sql(self) -> "str | list[str]":
283
+ """Get the CREATE TABLE SQL for the memory table.
284
+
285
+ Returns:
286
+ SQL statement(s) to create the memory table with indexes.
287
+ """
288
+ raise NotImplementedError
289
+
290
+ @abstractmethod
291
+ def _get_drop_memory_table_sql(self) -> "list[str]":
292
+ """Get the DROP TABLE SQL statements for this database dialect.
293
+
294
+ Returns:
295
+ List of SQL statements to drop the memory table and indexes.
296
+ """
297
+ raise NotImplementedError
298
+
299
+
300
+ class BaseSyncADKMemoryStore(ABC, Generic[ConfigT]):
301
+ """Base class for sync SQLSpec-backed ADK memory stores.
302
+
303
+ Implements storage operations for Google ADK memory entries using
304
+ SQLSpec database adapters with synchronous execution.
305
+
306
+ This abstract base class provides common functionality for sync database-specific
307
+ memory store implementations including:
308
+ - Connection management via SQLSpec configs
309
+ - Table name validation
310
+ - Memory entry CRUD operations
311
+ - Text search with optional full-text search support
312
+
313
+ Subclasses must implement dialect-specific SQL queries and will be created
314
+ in each adapter directory (e.g., sqlspec/adapters/sqlite/adk/store.py).
315
+
316
+ Args:
317
+ config: SQLSpec database configuration with extension_config["adk"] settings.
318
+
319
+ Notes:
320
+ Configuration is read from config.extension_config["adk"]:
321
+ - memory_table: Memory table name (default: "adk_memory_entries")
322
+ - memory_use_fts: Enable full-text search when supported (default: False)
323
+ - memory_max_results: Max search results (default: 20)
324
+ - owner_id_column: Optional owner FK column DDL (default: None)
325
+ - enable_memory: Whether memory is enabled (default: True)
326
+ """
327
+
328
+ __slots__ = (
329
+ "_config",
330
+ "_enabled",
331
+ "_max_results",
332
+ "_memory_table",
333
+ "_owner_id_column_ddl",
334
+ "_owner_id_column_name",
335
+ "_use_fts",
336
+ )
337
+
338
+ def __init__(self, config: ConfigT) -> None:
339
+ """Initialize the sync ADK memory store.
340
+
341
+ Args:
342
+ config: SQLSpec database configuration.
343
+
344
+ Notes:
345
+ Reads configuration from config.extension_config["adk"]:
346
+ - memory_table: Memory table name (default: "adk_memory_entries")
347
+ - memory_use_fts: Enable full-text search when supported (default: False)
348
+ - memory_max_results: Max search results (default: 20)
349
+ - owner_id_column: Optional owner FK column DDL (default: None)
350
+ - enable_memory: Whether memory is enabled (default: True)
351
+ """
352
+ self._config = config
353
+ store_config = self._get_store_config_from_extension()
354
+ self._enabled: bool = store_config.get("enable_memory", True)
355
+ self._memory_table: str = str(store_config["memory_table"])
356
+ self._use_fts: bool = bool(store_config.get("use_fts", False))
357
+ self._max_results: int = store_config.get("max_results", 20)
358
+ self._owner_id_column_ddl: str | None = store_config.get("owner_id_column")
359
+ self._owner_id_column_name: str | None = (
360
+ _parse_owner_id_column(self._owner_id_column_ddl) if self._owner_id_column_ddl else None
361
+ )
362
+ _validate_table_name(self._memory_table)
363
+
364
+ def _get_store_config_from_extension(self) -> "_ADKMemoryStoreConfig":
365
+ """Extract ADK memory configuration from config.extension_config.
366
+
367
+ Returns:
368
+ Dict with memory_table, use_fts, max_results, and optionally owner_id_column.
369
+ """
370
+ return _get_adk_memory_store_config(self._config)
371
+
372
+ @property
373
+ def config(self) -> ConfigT:
374
+ """Return the database configuration."""
375
+ return self._config
376
+
377
+ @property
378
+ def memory_table(self) -> str:
379
+ """Return the memory table name."""
380
+ return self._memory_table
381
+
382
+ @property
383
+ def enabled(self) -> bool:
384
+ """Return whether memory store is enabled."""
385
+ return self._enabled
386
+
387
+ @property
388
+ def use_fts(self) -> bool:
389
+ """Return whether full-text search is enabled."""
390
+ return self._use_fts
391
+
392
+ @property
393
+ def max_results(self) -> int:
394
+ """Return the max search results limit."""
395
+ return self._max_results
396
+
397
+ @property
398
+ def owner_id_column_ddl(self) -> "str | None":
399
+ """Return the full owner ID column DDL (or None if not configured)."""
400
+ return self._owner_id_column_ddl
401
+
402
+ @property
403
+ def owner_id_column_name(self) -> "str | None":
404
+ """Return the owner ID column name only (or None if not configured)."""
405
+ return self._owner_id_column_name
406
+
407
+ @abstractmethod
408
+ def create_tables(self) -> None:
409
+ """Create the memory table and indexes if they don't exist.
410
+
411
+ Should check self._enabled and skip table creation if False.
412
+ """
413
+ raise NotImplementedError
414
+
415
+ def ensure_tables(self) -> None:
416
+ """Create tables when enabled and emit a standardized log entry."""
417
+
418
+ if not self._enabled:
419
+ self._log_memory_table_skipped()
420
+ return
421
+ self.create_tables()
422
+ self._log_memory_table_created()
423
+
424
+ @abstractmethod
425
+ def insert_memory_entries(self, entries: "list[MemoryRecord]", owner_id: "object | None" = None) -> int:
426
+ """Bulk insert memory entries with deduplication.
427
+
428
+ Uses UPSERT pattern to skip duplicates based on event_id.
429
+
430
+ Args:
431
+ entries: List of memory records to insert.
432
+ owner_id: Optional owner ID value for owner_id_column (if configured).
433
+
434
+ Returns:
435
+ Number of entries actually inserted (excludes duplicates).
436
+
437
+ Raises:
438
+ RuntimeError: If memory store is disabled.
439
+ """
440
+ raise NotImplementedError
441
+
442
+ def _log_memory_table_created(self) -> None:
443
+ log_with_context(
444
+ logger,
445
+ logging.DEBUG,
446
+ "adk.memory.table.ready",
447
+ db_system=resolve_db_system(type(self).__name__),
448
+ memory_table=self._memory_table,
449
+ )
450
+
451
+ def _log_memory_table_skipped(self) -> None:
452
+ log_with_context(
453
+ logger,
454
+ logging.DEBUG,
455
+ "adk.memory.table.skipped",
456
+ db_system=resolve_db_system(type(self).__name__),
457
+ memory_table=self._memory_table,
458
+ reason="disabled",
459
+ )
460
+
461
+ @abstractmethod
462
+ def search_entries(
463
+ self, query: str, app_name: str, user_id: str, limit: "int | None" = None
464
+ ) -> "list[MemoryRecord]":
465
+ """Search memory entries by text query.
466
+
467
+ Uses the configured search strategy (simple ILIKE or FTS).
468
+
469
+ Args:
470
+ query: Text query to search for.
471
+ app_name: Application name to filter by.
472
+ user_id: User ID to filter by.
473
+ limit: Maximum number of results (defaults to max_results config).
474
+
475
+ Returns:
476
+ List of matching memory records ordered by relevance/timestamp.
477
+
478
+ Raises:
479
+ RuntimeError: If memory store is disabled.
480
+ """
481
+ raise NotImplementedError
482
+
483
+ @abstractmethod
484
+ def delete_entries_by_session(self, session_id: str) -> int:
485
+ """Delete all memory entries for a specific session.
486
+
487
+ Args:
488
+ session_id: Session ID to delete entries for.
489
+
490
+ Returns:
491
+ Number of entries deleted.
492
+ """
493
+ raise NotImplementedError
494
+
495
+ @abstractmethod
496
+ def delete_entries_older_than(self, days: int) -> int:
497
+ """Delete memory entries older than specified days.
498
+
499
+ Used for TTL cleanup operations.
500
+
501
+ Args:
502
+ days: Number of days to retain entries.
503
+
504
+ Returns:
505
+ Number of entries deleted.
506
+ """
507
+ raise NotImplementedError
508
+
509
+ @abstractmethod
510
+ def _get_create_memory_table_sql(self) -> "str | list[str]":
511
+ """Get the CREATE TABLE SQL for the memory table.
512
+
513
+ Returns:
514
+ SQL statement(s) to create the memory table with indexes.
515
+ """
516
+ raise NotImplementedError
517
+
518
+ @abstractmethod
519
+ def _get_drop_memory_table_sql(self) -> "list[str]":
520
+ """Get the DROP TABLE SQL statements for this database dialect.
521
+
522
+ Returns:
523
+ List of SQL statements to drop the memory table and indexes.
524
+ """
525
+ raise NotImplementedError
@@ -0,0 +1,184 @@
1
+ """Create ADK session, events, and memory tables migration using store DDL definitions."""
2
+
3
+ import inspect
4
+ import logging
5
+ from typing import TYPE_CHECKING, NoReturn, cast
6
+
7
+ from sqlspec.exceptions import SQLSpecError
8
+ from sqlspec.extensions.adk._config_utils import (
9
+ _get_adk_adapter_store_class,
10
+ _get_adk_memory_migration_store_class,
11
+ _is_adk_memory_migration_enabled,
12
+ )
13
+ from sqlspec.utils.logging import get_logger, log_with_context
14
+
15
+ if TYPE_CHECKING:
16
+ from sqlspec.extensions.adk.memory.store import BaseAsyncADKMemoryStore, BaseSyncADKMemoryStore
17
+ from sqlspec.extensions.adk.store import BaseAsyncADKStore
18
+ from sqlspec.migrations.context import MigrationContext
19
+
20
+ logger = get_logger("sqlspec.migrations.adk.tables")
21
+
22
+ __all__ = ("down", "up")
23
+
24
+
25
+ def _get_store_class(context: "MigrationContext | None") -> "type[BaseAsyncADKStore]":
26
+ """Get the appropriate store class based on the config's module path.
27
+
28
+ Args:
29
+ context: Migration context containing config.
30
+
31
+ Returns:
32
+ Store class matching the config's adapter.
33
+
34
+ Notes:
35
+ Dynamically imports the store class from the config's module path.
36
+ For example, AsyncpgConfig at 'sqlspec.adapters.asyncpg.config'
37
+ maps to AsyncpgADKStore at 'sqlspec.adapters.asyncpg.adk.AsyncpgADKStore'.
38
+ """
39
+ if not context or not context.config:
40
+ _raise_missing_config()
41
+
42
+ return cast("type[BaseAsyncADKStore]", _get_adk_adapter_store_class(context.config, "ADKStore"))
43
+
44
+
45
+ def _get_memory_store_class(
46
+ context: "MigrationContext | None",
47
+ ) -> "type[BaseAsyncADKMemoryStore | BaseSyncADKMemoryStore] | None":
48
+ """Get the appropriate memory store class based on the config's module path.
49
+
50
+ Args:
51
+ context: Migration context containing config.
52
+
53
+ Returns:
54
+ Memory store class matching the config's adapter, or None if not available.
55
+
56
+ Notes:
57
+ Dynamically imports the memory store class from the config's module path.
58
+ For example, AsyncpgConfig at 'sqlspec.adapters.asyncpg.config'
59
+ maps to AsyncpgADKMemoryStore at 'sqlspec.adapters.asyncpg.adk.AsyncpgADKMemoryStore'.
60
+ """
61
+ if not context or not context.config:
62
+ return None
63
+
64
+ store_class = _get_adk_memory_migration_store_class(context.config)
65
+ if store_class is None:
66
+ log_with_context(logger, logging.DEBUG, "adk.migration.memory_store.missing")
67
+ return None
68
+ return cast("type[BaseAsyncADKMemoryStore | BaseSyncADKMemoryStore]", store_class)
69
+
70
+
71
+ def _is_memory_enabled(context: "MigrationContext | None") -> bool:
72
+ """Check if memory migration is enabled in the config.
73
+
74
+ Args:
75
+ context: Migration context containing config.
76
+
77
+ Returns:
78
+ True if memory migration should be included, False otherwise.
79
+
80
+ Notes:
81
+ Checks config.extension_config["adk"]["include_memory_migration"].
82
+ Defaults to True if not specified and enable_memory is True.
83
+ """
84
+ if not context or not context.config:
85
+ return False
86
+
87
+ return _is_adk_memory_migration_enabled(context.config)
88
+
89
+
90
+ def _raise_missing_config() -> NoReturn:
91
+ """Raise error when migration context has no config.
92
+
93
+ Raises:
94
+ SQLSpecError: Always raised.
95
+ """
96
+ msg = "Migration context must have a config to determine store class"
97
+ raise SQLSpecError(msg)
98
+
99
+
100
+ async def up(context: "MigrationContext | None" = None) -> "list[str]":
101
+ """Create the ADK session, events, and memory tables using store DDL definitions.
102
+
103
+ This migration delegates to the appropriate store class to generate
104
+ dialect-specific DDL. The store classes contain the single source of
105
+ truth for table schemas.
106
+
107
+ Args:
108
+ context: Migration context containing config.
109
+
110
+ Returns:
111
+ List of SQL statements to execute for upgrade.
112
+
113
+ Notes:
114
+ Configuration is read from context.config.extension_config["adk"].
115
+ Supports custom table names and optional owner_id_column for linking
116
+ sessions to owner tables (users, tenants, teams, etc.).
117
+ Memory table is included if enable_memory or include_memory_migration is True.
118
+ """
119
+ if context is None or context.config is None:
120
+ _raise_missing_config()
121
+
122
+ store_class = _get_store_class(context)
123
+ store_instance = store_class(config=context.config)
124
+
125
+ statements = [
126
+ await store_instance._get_create_sessions_table_sql(), # pyright: ignore[reportPrivateUsage]
127
+ await store_instance._get_create_events_table_sql(), # pyright: ignore[reportPrivateUsage]
128
+ ]
129
+
130
+ if _is_memory_enabled(context):
131
+ memory_store_class = _get_memory_store_class(context)
132
+ if memory_store_class is not None:
133
+ memory_store = memory_store_class(config=context.config)
134
+ memory_sql = memory_store._get_create_memory_table_sql() # pyright: ignore[reportPrivateUsage]
135
+ if inspect.isawaitable(memory_sql):
136
+ memory_sql = await memory_sql
137
+ if isinstance(memory_sql, list):
138
+ statements.extend(memory_sql)
139
+ else:
140
+ statements.append(memory_sql)
141
+ log_with_context(
142
+ logger, logging.DEBUG, "adk.migration.memory.include", table_name=memory_store.memory_table
143
+ )
144
+
145
+ return statements
146
+
147
+
148
+ async def down(context: "MigrationContext | None" = None) -> "list[str]":
149
+ """Drop the ADK session, events, and memory tables using store DDL definitions.
150
+
151
+ This migration delegates to the appropriate store class to generate
152
+ dialect-specific DROP statements. The store classes contain the single
153
+ source of truth for table schemas.
154
+
155
+ Args:
156
+ context: Migration context containing config.
157
+
158
+ Returns:
159
+ List of SQL statements to execute for downgrade.
160
+
161
+ Notes:
162
+ Configuration is read from context.config.extension_config["adk"].
163
+ Memory table is included if enable_memory or include_memory_migration is True.
164
+ """
165
+ if context is None or context.config is None:
166
+ _raise_missing_config()
167
+
168
+ statements: list[str] = []
169
+
170
+ if _is_memory_enabled(context):
171
+ memory_store_class = _get_memory_store_class(context)
172
+ if memory_store_class is not None:
173
+ memory_store = memory_store_class(config=context.config)
174
+ memory_drop_stmts = memory_store._get_drop_memory_table_sql() # pyright: ignore[reportPrivateUsage]
175
+ statements.extend(memory_drop_stmts)
176
+ log_with_context(
177
+ logger, logging.DEBUG, "adk.migration.memory.drop.include", table_name=memory_store.memory_table
178
+ )
179
+
180
+ store_class = _get_store_class(context)
181
+ store_instance = store_class(config=context.config)
182
+ statements.extend(store_instance._get_drop_tables_sql()) # pyright: ignore[reportPrivateUsage]
183
+
184
+ return statements