sqlspec 0.22.0__py3-none-any.whl → 0.24.0__py3-none-any.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.
Potentially problematic release.
This version of sqlspec might be problematic. Click here for more details.
- sqlspec/_sql.py +36 -0
- sqlspec/builder/_base.py +68 -21
- sqlspec/builder/_ddl.py +14 -13
- sqlspec/builder/_insert.py +8 -16
- sqlspec/builder/_parsing_utils.py +16 -18
- sqlspec/builder/_update.py +1 -1
- sqlspec/builder/mixins/_cte_and_set_ops.py +20 -1
- sqlspec/builder/mixins/_join_operations.py +205 -85
- sqlspec/builder/mixins/_where_clause.py +743 -124
- sqlspec/utils/type_guards.py +31 -0
- {sqlspec-0.22.0.dist-info → sqlspec-0.24.0.dist-info}/METADATA +1 -1
- {sqlspec-0.22.0.dist-info → sqlspec-0.24.0.dist-info}/RECORD +16 -16
- {sqlspec-0.22.0.dist-info → sqlspec-0.24.0.dist-info}/WHEEL +0 -0
- {sqlspec-0.22.0.dist-info → sqlspec-0.24.0.dist-info}/entry_points.txt +0 -0
- {sqlspec-0.22.0.dist-info → sqlspec-0.24.0.dist-info}/licenses/LICENSE +0 -0
- {sqlspec-0.22.0.dist-info → sqlspec-0.24.0.dist-info}/licenses/NOTICE +0 -0
sqlspec/utils/type_guards.py
CHANGED
|
@@ -68,6 +68,8 @@ __all__ = (
|
|
|
68
68
|
"has_attr",
|
|
69
69
|
"has_bytes_conversion",
|
|
70
70
|
"has_dict_attribute",
|
|
71
|
+
"has_expression_and_parameters",
|
|
72
|
+
"has_expression_and_sql",
|
|
71
73
|
"has_expression_attr",
|
|
72
74
|
"has_expressions",
|
|
73
75
|
"has_expressions_attribute",
|
|
@@ -1211,3 +1213,32 @@ def is_typed_parameter(obj: Any) -> "TypeGuard[Any]":
|
|
|
1211
1213
|
from sqlspec.core.parameters import TypedParameter
|
|
1212
1214
|
|
|
1213
1215
|
return isinstance(obj, TypedParameter)
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
def has_expression_and_sql(obj: Any) -> bool:
|
|
1219
|
+
"""Check if an object has both 'expression' and 'sql' attributes.
|
|
1220
|
+
|
|
1221
|
+
This is commonly used to identify SQL objects in the builder system.
|
|
1222
|
+
|
|
1223
|
+
Args:
|
|
1224
|
+
obj: The object to check
|
|
1225
|
+
|
|
1226
|
+
Returns:
|
|
1227
|
+
True if the object has both attributes, False otherwise
|
|
1228
|
+
"""
|
|
1229
|
+
return hasattr(obj, "expression") and hasattr(obj, "sql")
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
def has_expression_and_parameters(obj: Any) -> bool:
|
|
1233
|
+
"""Check if an object has both 'expression' and 'parameters' attributes.
|
|
1234
|
+
|
|
1235
|
+
This is used to identify objects that contain both SQL expressions
|
|
1236
|
+
and parameter mappings.
|
|
1237
|
+
|
|
1238
|
+
Args:
|
|
1239
|
+
obj: The object to check
|
|
1240
|
+
|
|
1241
|
+
Returns:
|
|
1242
|
+
True if the object has both attributes, False otherwise
|
|
1243
|
+
"""
|
|
1244
|
+
return hasattr(obj, "expression") and hasattr(obj, "parameters")
|
|
@@ -2,7 +2,7 @@ sqlspec/__init__.py,sha256=JkL9cp1h19tz1rCl-3WAep6kbZs8JLxNlb1SrQl8PWc,2114
|
|
|
2
2
|
sqlspec/__main__.py,sha256=lXBKZMOXA1uY735Rnsb-GS7aXy0nt22tYmd2X9FcxrY,253
|
|
3
3
|
sqlspec/__metadata__.py,sha256=IUw6MCTy1oeUJ1jAVYbuJLkOWbiAWorZ5W-E-SAD9N4,395
|
|
4
4
|
sqlspec/_serialization.py,sha256=6U5-smk2h2yl0i6am2prtOLJTdu4NJQdcLlSfSUMaUQ,2590
|
|
5
|
-
sqlspec/_sql.py,sha256=
|
|
5
|
+
sqlspec/_sql.py,sha256=QHx_awVF6yFxcNLcuAk19AnJe1FvX1FwqjxhJcUjXD4,46221
|
|
6
6
|
sqlspec/_typing.py,sha256=jv-7QHGLrJLfnP86bR-Xcmj3PDoddNZEKDz_vYRBiAU,22684
|
|
7
7
|
sqlspec/base.py,sha256=koDh1AecwCAkntSqSda6J_cpMOLonXiV6hh3GCCXf_s,25459
|
|
8
8
|
sqlspec/cli.py,sha256=Fe5Wbnrb_fkE9qm4gbBEXx3d0Q7VR-S-1t76ouAx2mg,20120
|
|
@@ -58,27 +58,27 @@ sqlspec/adapters/sqlite/config.py,sha256=zXKipKuTPjFSUgdc5tiHAZF5hW33jvrrElNJAQh
|
|
|
58
58
|
sqlspec/adapters/sqlite/driver.py,sha256=DABBt0cttdTlQdkqxwgV66AMMNp543K4_qanslTrHWI,11341
|
|
59
59
|
sqlspec/adapters/sqlite/pool.py,sha256=bKIrf3hgach6bMyFQORCdqnpN-sTfMagB3l61uPCGJI,4435
|
|
60
60
|
sqlspec/builder/__init__.py,sha256=iEniDtKnYOhPOgN7OhcvAO5leYdzXQTlFE8XXKWvhzg,1652
|
|
61
|
-
sqlspec/builder/_base.py,sha256=
|
|
61
|
+
sqlspec/builder/_base.py,sha256=ATEEnP-CII17C-7oWdYSeTlWp0vPUmdxiU___9V4FqQ,20139
|
|
62
62
|
sqlspec/builder/_column.py,sha256=HyDaui_qMuqID7SySL_Z7RKFSSbXGgngbkoCR9V2tcY,13245
|
|
63
|
-
sqlspec/builder/_ddl.py,sha256=
|
|
63
|
+
sqlspec/builder/_ddl.py,sha256=XyFaz6RQy9l4oOIsFXbFHNelmrHZuZGqz929cwvUxLQ,56492
|
|
64
64
|
sqlspec/builder/_delete.py,sha256=icYjrxXIMSWso5TBkd712kmyUZMCWIxdIZHH24nCPAA,2130
|
|
65
65
|
sqlspec/builder/_expression_wrappers.py,sha256=HTl8qAFD4sZNXLD2akkJWGCPse2HWS237mTGE4Cx_7I,1244
|
|
66
|
-
sqlspec/builder/_insert.py,sha256=
|
|
66
|
+
sqlspec/builder/_insert.py,sha256=ND5g1s0CYQ_HNYyWwVh1FKmq0R8to8a6UIf5MO6O6oE,16187
|
|
67
67
|
sqlspec/builder/_merge.py,sha256=_Qs6YnJa0_6-pb21zk03PxDWsC7DdZnYfGxJfz-P6Ao,1886
|
|
68
|
-
sqlspec/builder/_parsing_utils.py,sha256=
|
|
68
|
+
sqlspec/builder/_parsing_utils.py,sha256=q_smaMGDgfn-rn166-1iCBQsJhe8-c_Xszi9PxyW9A0,8169
|
|
69
69
|
sqlspec/builder/_select.py,sha256=aAPZs1iY7n3NH2ihg0m29pqNr80MW6l5dDbvIXfgGEk,5709
|
|
70
|
-
sqlspec/builder/_update.py,sha256=
|
|
70
|
+
sqlspec/builder/_update.py,sha256=oVgDVps8XXAXVJXLFyz3ydIjYONTh35Xkk3bWCCPgoQ,5882
|
|
71
71
|
sqlspec/builder/mixins/__init__.py,sha256=YXhAzKmQbQtne5j26SKWY8PUxwosl0RhlhLoahAdkj0,1885
|
|
72
|
-
sqlspec/builder/mixins/_cte_and_set_ops.py,sha256=
|
|
72
|
+
sqlspec/builder/mixins/_cte_and_set_ops.py,sha256=vDFeTZ97fXQEi8eRgQ_jGuzUacg_BnUlC341TVyW1TI,10140
|
|
73
73
|
sqlspec/builder/mixins/_delete_operations.py,sha256=LCzXoNtPUVgJ5KxhKoQj-METq51g5aDqoEmDmB66e08,1271
|
|
74
74
|
sqlspec/builder/mixins/_insert_operations.py,sha256=ipU1Hhue6MRFfbouDDXyONGC9-jmW7LYuo4HuMtioJs,10437
|
|
75
|
-
sqlspec/builder/mixins/_join_operations.py,sha256=
|
|
75
|
+
sqlspec/builder/mixins/_join_operations.py,sha256=1CN1E6TwtFng4ftKmIYN0MAJNZLkWISGB2UY1E1tivw,16036
|
|
76
76
|
sqlspec/builder/mixins/_merge_operations.py,sha256=v2JZbyOZyT5mS0cJo82ckjE9eR2LqoAS-YO2NJWK2a4,24297
|
|
77
77
|
sqlspec/builder/mixins/_order_limit_operations.py,sha256=i5QXZ_1aCzAhv3VG4Tp08kW8vYqEHU04TRoZPZgS2KA,5573
|
|
78
78
|
sqlspec/builder/mixins/_pivot_operations.py,sha256=s3b2zSOL0zEXEGXo1lBm5MuqXWl15qMww_krsmFqj3I,6163
|
|
79
79
|
sqlspec/builder/mixins/_select_operations.py,sha256=GysHSEoO55JSzkqZVuRFVvIP0URN1kYq0NoE-5Alye8,35338
|
|
80
80
|
sqlspec/builder/mixins/_update_operations.py,sha256=izXw0ZeQQeMS0wQRNniEBKIlEaNIking89uAcLSbYLk,8752
|
|
81
|
-
sqlspec/builder/mixins/_where_clause.py,sha256=
|
|
81
|
+
sqlspec/builder/mixins/_where_clause.py,sha256=sinIoL4MCs5ppbvKYzqI9yC_5JqPXL2kRJX9sXwazsA,66072
|
|
82
82
|
sqlspec/core/__init__.py,sha256=4pD6ymg_sZxh9QyAmsk3oNyvUWPoQj9qktg0uNJVp6k,5264
|
|
83
83
|
sqlspec/core/cache.py,sha256=835tHhe3fan9_h_Y9CJ-4aAl8K-0cNMwfQzcxMzjlqQ,24837
|
|
84
84
|
sqlspec/core/compiler.py,sha256=VYY9lPXs-iD6agQvPzAy6sAhw-WsHjJ7pGC2Olljs_s,12562
|
|
@@ -130,10 +130,10 @@ sqlspec/utils/serializers.py,sha256=GXsTkJbWAhRS7xDMk6WBouZwPeG4sI_brLdMBlIetNg,
|
|
|
130
130
|
sqlspec/utils/singleton.py,sha256=-j-s6LS0pP_wTEUYIyK2wSdoeIE_tn7O7B-j7_aODRQ,1252
|
|
131
131
|
sqlspec/utils/sync_tools.py,sha256=ONdhmx1Dq0_c6ReRaTlXzz6dVmAwz6CybCvsTUAVu1g,8768
|
|
132
132
|
sqlspec/utils/text.py,sha256=ZqaXCVuUbdj_110pdTYjmAxfV3ZtR7J6EixuNazQLFY,3333
|
|
133
|
-
sqlspec/utils/type_guards.py,sha256=
|
|
134
|
-
sqlspec-0.
|
|
135
|
-
sqlspec-0.
|
|
136
|
-
sqlspec-0.
|
|
137
|
-
sqlspec-0.
|
|
138
|
-
sqlspec-0.
|
|
139
|
-
sqlspec-0.
|
|
133
|
+
sqlspec/utils/type_guards.py,sha256=0KCosuWZXWExUDJTHPSAP0KxXOokX3eraTjTxURUAJ0,33762
|
|
134
|
+
sqlspec-0.24.0.dist-info/METADATA,sha256=y0O0LJpct4R-ody8hN-BtyfjZktoNoUhXYYWAf26Mwg,23548
|
|
135
|
+
sqlspec-0.24.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
136
|
+
sqlspec-0.24.0.dist-info/entry_points.txt,sha256=G-ZqY1Nuuw3Iys7nXw23f6ILenk_Lt47VdK2mhJCWHg,53
|
|
137
|
+
sqlspec-0.24.0.dist-info/licenses/LICENSE,sha256=MdujfZ6l5HuLz4mElxlu049itenOR3gnhN1_Nd3nVcM,1078
|
|
138
|
+
sqlspec-0.24.0.dist-info/licenses/NOTICE,sha256=Lyir8ozXWov7CyYS4huVaOCNrtgL17P-bNV-5daLntQ,1634
|
|
139
|
+
sqlspec-0.24.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|