Skip to main content

A package to run SQL script or SQL file script in an instance of sql server

Project description

py-scripto

This is to run SQL script or file script in an instance of sql server

Installation:

python -m pip install py_scripto

Version used

SQL Server 2019
Python 3.7.5

DEPENDENCIES

DbExec stored procedure

  1. Download from https://github.com/datnguye/SQL-Server/blob/master/maintenance/DbExec.sql

  2. Compile it to master database

xp_cmdshell need enabling on SQL instance

EXEC sp_configure 'show advanced option', 1
RECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell', 1
RECONFIGURE
GO

USAGE

from py_scripto import sqlserver
sqlserver.run_file_script(server="DAVID\DAVID", uid="py-scripto", pwd="py-scripto", connect_to_db="IMPORT", script_path="D:\\Downloads\\test.sql")
sqlserver.run_script(server="DAVID\DAVID", uid="py-scripto", pwd="py-scripto", connect_to_db="IMPORT", sql="SELECT * FROM Test WITH (NOLOCK)")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_scripto-0.1.4.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

py_scripto-0.1.4-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file py_scripto-0.1.4.tar.gz.

File metadata

  • Download URL: py_scripto-0.1.4.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for py_scripto-0.1.4.tar.gz
Algorithm Hash digest
SHA256 fe13b3671930fd1f39ddaede466ac3ee1fb6ac4d334e09a5fbb1f1147267633a
MD5 ec8edac22ce46ede9e0f5eecbbfd8c18
BLAKE2b-256 c8cc8189aed5774834c4d9b6ae2c3b6be2884a38cb7de8d9b96dce636a2f5957

See more details on using hashes here.

File details

Details for the file py_scripto-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: py_scripto-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.2.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

File hashes

Hashes for py_scripto-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 630172f518ceae153e969ad68298d58fb351e2e8b632369defe650ca98f7fcc4
MD5 4e83fc1234739c4c3b0db83d245edba8
BLAKE2b-256 ef7c8a0c9b8210ada7b23a23de4a20d21665eaab6fc7eec64165f11ed62664a9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page