{"id":18029097,"url":"https://github.com/quantco/pytsql","last_synced_at":"2025-03-27T03:30:52.399Z","repository":{"id":37982568,"uuid":"452314427","full_name":"Quantco/pytsql","owner":"Quantco","description":"Run mssql scripts from Python.","archived":false,"fork":false,"pushed_at":"2025-03-03T07:40:52.000Z","size":7035,"stargazers_count":15,"open_issues_count":10,"forks_count":3,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-23T00:23:10.694Z","etag":null,"topics":["database","mssql","sql","tsql"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Quantco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-26T14:48:18.000Z","updated_at":"2025-03-03T07:40:54.000Z","dependencies_parsed_at":"2023-02-17T06:30:57.390Z","dependency_job_id":"48a1e254-9ad6-47d3-8ac7-92c17487a561","html_url":"https://github.com/Quantco/pytsql","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantco%2Fpytsql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantco%2Fpytsql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantco%2Fpytsql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantco%2Fpytsql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Quantco","download_url":"https://codeload.github.com/Quantco/pytsql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245778377,"owners_count":20670682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","mssql","sql","tsql"],"created_at":"2024-10-30T09:08:06.417Z","updated_at":"2025-03-27T03:30:52.393Z","avatar_url":"https://github.com/Quantco.png","language":"C++","readme":"# pytsql\n\n[![CI](https://github.com/Quantco/pytsql/workflows/CI/badge.svg)](https://github.com/Quantco/pytsql/actions)\n[![Documentation Status](https://readthedocs.org/projects/pytsql/badge/?version=latest)](https://pytsql.readthedocs.io/en/latest/?badge=latest)\n[![Conda-forge](https://img.shields.io/conda/vn/conda-forge/pytsql?logoColor=white\u0026logo=conda-forge)](https://anaconda.org/conda-forge/pytsql)\n[![PypiVersion](https://img.shields.io/pypi/v/pytsql.svg?logo=pypi\u0026logoColor=white)](https://pypi.org/project/pytsql)\n\n\n`pytsql` allows to run mssql scripts, typically run from GUIs, from Python.\n\nThis, in turn, eases concurrent, scheduled and chained execution of scripts in a\nworkflow. Put differently, it enables automated execution of Microsoft sql server scripts.\n\nMoreover, `pytsql` supports parametrization of scripts, akin to templating.\n\nPlease have a look at our [documentation](https://pytsql.readthedocs.io/en/latest/?badge=latest) if you're curious about more details.\n\n## Installation\n\nTo install, execute:\n\n```bash\npip install pytsql\n```\n\nor in a `conda` environment\n\n```bash\nmamba install pytsql\n```\n\nBe aware that depending on your platform, you'will need specific drivers ([Windows](https://docs.microsoft.com/en-us/sql/connect/odbc/windows/microsoft-odbc-driver-for-sql-server-on-windows?view=sql-server-ver15), [Linux](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15), [macOS](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/install-microsoft-odbc-driver-sql-server-macos?view=sql-server-ver15)).\n\n## Usage\n\n`pytsql` is tailored to run with MSSQL. Other sql dialects are not supported.\n\nThe main function of interest is `execute`. It requires a `sqlalchemy` [`Engine`][engine]\nobject as well as the path to the sql script of interest. A typical use case might look as follows:\n\n```python\nimport pytsql\nfrom sqlalchemy import sa\n\ndb_connection_string = \"connection_to_my_database\"\nengine = sa.get_engine(db_connection_string)\n\npytsql.execute(\"my_sql_script.sql\", engine)\n```\n\nPlease also have a look at our documentation sections on [usage](https://pytsql.readthedocs.io/en/latest/usage.html#parametrization) and\n[development](https://pytsql.readthedocs.io/en/latest/development.html).\n\n[engine]: https://docs.sqlalchemy.org/en/14/core/engines.html\n\n\n## Credits\n\nGrammar is based on [antlr4/grammars-v4](https://github.com/antlr/grammars-v4/tree/master/sql/tsql).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantco%2Fpytsql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquantco%2Fpytsql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantco%2Fpytsql/lists"}