Commit c14cc42
authored
FEAT: Adding setinputsizes (#192)
### Work Item / Issue Reference
<!--
IMPORTANT: Please follow the PR template guidelines below.
For mssql-python maintainers: Insert your ADO Work Item ID below (e.g.
AB#37452)
For external contributors: Insert Github Issue number below (e.g. #149)
Only one reference is required - either GitHub issue OR ADO Work Item.
-->
<!-- mssql-python maintainers: ADO Work Item -->
>
[AB#32890](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/32890)
-------------------------------------------------------------------
### Summary
This pull request adds comprehensive support for advanced SQL metadata
and catalog functions to the MSSQL Python bindings, making it easier to
interact with database schema information and supported data types from
Python. The changes include new wrapper functions and Python bindings
for several ODBC catalog APIs, the addition of SQL type constants, and
enhancements to the constants module for easier type validation and
categorization.
### SQL Catalog & Metadata API Support
* Added wrapper functions and Python bindings for ODBC catalog APIs:
`SQLGetTypeInfo`, `SQLProcedures`, `SQLForeignKeys`, `SQLPrimaryKeys`,
`SQLSpecialColumns`, `SQLStatistics`, and `SQLColumns` in
`ddbc_bindings.cpp`. These allow Python code to directly query metadata
about tables, columns, keys, procedures, and supported types.
### Constants and Type Handling
* Exported SQL type constants (e.g., `SQL_CHAR`, `SQL_INTEGER`, etc.) at
the module level in `__init__.py` for easier use in Python code.
* Added new constants to `ConstantsDDBC` for catalog API parameters such
as `SQL_SCOPE_CURROW`, `SQL_BEST_ROWID`, `SQL_ROWVER`, and others.
* Introduced the `SQLTypes` class in `constants.py`, providing methods
to retrieve sets of valid SQL types and categorize them (e.g., string
types, numeric types), which can help with input validation and type
checking in Python.
These changes significantly improve the ability of Python applications
to introspect and work with database schema and type information, making
your code more robust and flexible when dealing with SQL Server
databases.
---------
Co-authored-by: Jahnvi Thakkar <jathakkar@microsoft.com>1 parent d521601 commit c14cc42
File tree
8 files changed
+4403
-194
lines changed- mssql_python
- pybind
- tests
8 files changed
+4403
-194
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
127 | 136 | | |
128 | 137 | | |
129 | 138 | | |
130 | 139 | | |
131 | 140 | | |
132 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
0 commit comments