From 28dce7103d07e058326fc393b50e5373542c70bb Mon Sep 17 00:00:00 2001 From: Perry Skountrianos Date: Mon, 3 Mar 2025 07:59:06 -0800 Subject: [PATCH 1/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 535c4247..62b75c6c 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ connection = ("SERVER=;DATABASE=;UID= Date: Mon, 3 Mar 2025 09:55:54 -0800 Subject: [PATCH 2/7] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 62b75c6c..dbe82d10 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ [Documentation](https://github.com/microsoft/mssql-python/wiki) | [Release Notes](https://github.com/microsoft/mssql-python/releases) | [Roadmap](https://github.com/microsoft/mssql-python/blob/main/ROADMAP.md) +> **Note:** +> This project is currently in an alpha phase, meaning it is still under active development. We are looking to validate core functionalities and gather initial feedback before a broader public launch. Please use with caution and avoid production environments. +> ## Installation mssql-python can be installed with [pip](http://pypi.python.org/pypi/pip) From 0d94ac7faaed3cbae505f64a8717bc5553ed3d1f Mon Sep 17 00:00:00 2001 From: Sandeep Pawar <62612119+pawarbi@users.noreply.github.com> Date: Tue, 11 Mar 2025 14:00:56 -0500 Subject: [PATCH 3/7] Update README.md connection fixed: connection_string = ("SERVER=;DATABASE=;UID=;PWD=;Encrypt=yes;") connection = mssql_python.connect(connection_string) --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dbe82d10..38d67c5e 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ import mssql_python # Establish a connection # Specify connection string -connection = ("SERVER=;DATABASE=;UID=;PWD=;Encrypt=yes;") +connection_string = ("SERVER=;DATABASE=;UID=;PWD=;Encrypt=yes;") +connection = mssql_python.connect(connection_string) # Execute a query cursor = connection.cursor() From a435f102f5005627f1fe1593e484b5faf7e81d1a Mon Sep 17 00:00:00 2001 From: Perry Skountrianos Date: Mon, 17 Mar 2025 11:52:34 -0700 Subject: [PATCH 4/7] Update README.md Updating code sample. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dbe82d10..384e90c0 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ import mssql_python # Establish a connection # Specify connection string -connection = ("SERVER=;DATABASE=;UID=;PWD=;Encrypt=yes;") +connection = connect("SERVER=;DATABASE=;UID=;PWD=;Encrypt=yes;") # Execute a query cursor = connection.cursor() From 5dad86c3b8bd60e7dea7aa6f02044f5dc24b578e Mon Sep 17 00:00:00 2001 From: Gaurav Sharma Date: Wed, 19 Mar 2025 12:37:53 +0530 Subject: [PATCH 5/7] added setup.py --- setup.py | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..457b5682 --- /dev/null +++ b/setup.py @@ -0,0 +1,65 @@ +import os +import sys +import subprocess +from setuptools import setup, Extension, find_packages +from setuptools.command.build_ext import build_ext + +class CMakeExtension(Extension): + def __init__(self, name, sourcedir=''): + # No sources; CMake handles the build. + super().__init__(name, sources=[]) + self.sourcedir = os.path.abspath(sourcedir) + +class CMakeBuild(build_ext): + def run(self): + # Check if CMake is installed + try: + subprocess.check_output(['cmake', '--version']) + except OSError: + raise RuntimeError("CMake must be installed to build these extensions.") + for ext in self.extensions: + self.build_extension(ext) + + def build_extension(self, ext): + # Calculate the directory where the final .pyd will be placed (inside mssql_python) + extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) + cfg = 'Debug' if self.debug else 'Release' + cmake_args = [ + '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir, + '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=' + extdir, + '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=' + extdir, + '-DPYTHON_EXECUTABLE=' + sys.executable, + '-DCMAKE_BUILD_TYPE=' + cfg + ] + build_args = ['--config', cfg] + + if not os.path.exists(self.build_temp): + os.makedirs(self.build_temp) + + # Configure CMake project + subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp) + # Build the target defined in your CMakeLists.txt + subprocess.check_call(['cmake', '--build', '.', '--target', 'ddbc_bindings'] + build_args, cwd=self.build_temp) + +setup( + name='mssql-python', + version='0.1.5', + description='A Python library for interacting with Microsoft SQL Server', + long_description=open('README.md', encoding='utf-8').read(), + long_description_content_type='text/markdown', + author='Microsoft Corporation', + author_email='pysqldriver@microsoft.com', + url='https://github.com/microsoft/mssql-python', + packages=find_packages(), + package_data={ + # Include DLL files inside mssql_python + 'mssql_python': ['libs/*', 'libs/**/*', '*.dll'] + }, + include_package_data=True, + # Requires Python 3.13 + python_requires='==3.13.*', + # Naming the extension as mssql_python.ddbc_bindings puts the .pyd directly in mssql_python + ext_modules=[CMakeExtension('mssql_python.ddbc_bindings', sourcedir='mssql_python/pybind')], + cmdclass={'build_ext': CMakeBuild}, + zip_safe=False, +) From 3eaf899945049b8655b746ee7e3c09d4e46985fa Mon Sep 17 00:00:00 2001 From: Gaurav Sharma Date: Tue, 25 Mar 2025 23:32:27 +0530 Subject: [PATCH 6/7] Update example code in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 38d67c5e..b1e5a9b5 100644 --- a/README.md +++ b/README.md @@ -47,12 +47,12 @@ The driver offers a suite of Pythonic enhancements that streamline database inte Connect to SQL Server and execute a simple query: ```python -import mssql_python +from mssql_python import connect # Establish a connection # Specify connection string connection_string = ("SERVER=;DATABASE=;UID=;PWD=;Encrypt=yes;") -connection = mssql_python.connect(connection_string) +connection = connect(connection_string) # Execute a query cursor = connection.cursor() From 575cde7ea98389aa640705b3bd15f8e858a92f3c Mon Sep 17 00:00:00 2001 From: Sumit Sarabhai Date: Wed, 2 Apr 2025 13:03:27 +0530 Subject: [PATCH 7/7] Update README.md Update Readme with correct example. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index af884921..3bd890fb 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ The driver offers a suite of Pythonic enhancements that streamline database inte Connect to SQL Server and execute a simple query: ```python -from mssql_python import connect +import mssql_python # Establish a connection # Specify connection string