
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
FreeTDS
FreeTDS
from bash scriptYou may look at my script @ https://github.com/adgsenpai/InstallFreeTDS
FreeTDS
Manuallysudo apt-get install unixodbc unixodbc-dev freetds-dev freetds-bin tdsodbc
odbcinst.ini
to the driver in /etc/odbcinst.ini
[FreeTDS]
Description = v0.91 with protocol v7.2
Driver = MYDRIVERPATH
where MYDRIVERPATH
is the path of the libtdsodbc.so
file
Hint! Look in the /usr/lib/mylinuxdistro/odbc
folder!
Will implement script in the future to install/automate this for linux solutions.
pip install sqlserver
pip install sqlserver
DRIVERS = db.ReturnDrivers()
# output of drivers
['SQL Server', 'ODBC Driver 17 for SQL Server', 'SQL Server Native Client 11.0', 'SQL Server Native Client RDA 11.0', 'Microsoft Access Driver (*.mdb, *.accdb)', 'Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)', 'Microsoft Access Text Driver (*.txt, *.csv)']
# We can use a SQL ODBC Driver or FreeTDS
DRIVER={ODBC Driver 17 for SQL Server};SERVER=SERVERNAME,PORT;DATABASE=DB;UID=USERNAME;PWD=PASSWORD
import sqlserver
db = sqlserver.adgsqlserver('yourconnectionstring')
parms
: ExecuteQuery(query:str)
This enables you to execute any query without any stdout
but returns a bool
True
or False
if query passes and logs exception
in terminal as stdout
.
query = 'somequery'
db.ExecuteQuery()
parms
: GetRecordsAsDict(query:str)
We use this for select
statements or any other query that returns a table
as a result.
query = "SELECT 'Connection Passed' AS Result"
db.GetRecordsAsDict(query)
stdout
{'results': [{'Result': 'Connection Passed'}]}
parms
: GetRecordsOfColumn(query:str,ColumnName:str)
We use this for select
statements or any other query that returns a table
as a result.
db.GetRecordsOfColumn("SELECT 'Connection Passed' AS Result", "Result")
stdout
['Connection Passed']
parms
: CreateCSVTable(csvfile:str)
Creates a SQL Table with varchar(max) columns such that it can be ready to be inserted to based on the .csv column names
Assumption: somefile.csv
name,surname,phonenumber
test,testor,01234567810
path = 'C:/somefile.csv'
db.CreateCSVTable(path)
In SQL Table somefile.dbo
|name|surname|phonenumber|
parms
: InsertCSVTable(csvfile:str)
Assumption: somefile.csv
name,surname,phonenumber
test,testor,01234567810
path = 'C:/somefile.csv'
db.InsertCSVTable(path)
In SQL Table somefile.dbo
--------------------------
|name|surname|phonenumber|
|----|-------|-----------|
|test|testor |01234567810|
--------------------------
parms
: InsertXMLSQLTable(xmlfilepath:str)
xmlfilepath = 'C:/somexml.xml'
db.InsertXMLSQLTable(xmlfilepath)
parms
: InsertScript(df:DataFrame,tblName:str,isNEWID:bool=False)
df = pd.DataFrame({'name':['test','test2'],'surname':['testor','testor2'],'phonenumber':['01234567810','01234567810']})
db.InsertScript(df,'somefile')
stdout
'''
INSERT INTO [somefile]
VALUES
('test','testor','01234567810'),
('test2','testor2','01234567810')
'''
parms
: UpdateScript(dataDict:dict,whereCondition:str,tblName:str)
dataDict = {'name':'test','surname':'testor','phonenumber':'01234567810'}
whereCondition = "name = 'test'"
db.UpdateScript(dataDict,whereCondition,'somefile')
stdout
'''
UPDATE [dbo].[somefile]
SET
[name] = 'test',
[surname] = 'testor',
[phonenumber] = '01234567810'
WHERE
name = 'test'
'''
parms
: DeleteScript(whereCondition:str,tblName:str)
whereCondition = "name = 'test'"
db.DeleteScript(whereCondition,'somefile')
stdout
'''
DELETE FROM [dbo].[somefile]
WHERE
name = 'test'
'''
parms
: SelectScript(whereCondition:str,tblName:str)
whereCondition = "name = 'test'"
db.SelectScript(whereCondition,'somefile')
stdout
'''
SELECT * FROM [dbo].[somefile]
WHERE
name = 'test'
'''
parms
: ExecuteScript(query:str)
query = "SELECT 'Connection Passed' AS Result"
db.ExecuteScript(query)
stdout
{'results': [{'Result': 'Connection Passed'}]}
FAQs
a module that makes queries easier to SQL Server than PYODBC
We found that sqlserver demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.