Skip to main content

A utility package for sql work

Project description

talksql

Examples

ipcfg = {
    'user': '',
    'password': '',
    'host': '',
	'db':'' }

cfg = { 'socket':"/tmp/mysql.sock",
    'user': '',
    'password': '',
    'host': '',
	'db':'' }

from talksql import *
con = ipconnect(ipcfg) #or
con = sockconnect(cfg)
#con is mysql connector connection object

Get a resultset

from talksql import *
sql="select * from table where .." 
rs,c = xecrs(con,sql)
#rs is array for rows and columns of resultset
#c is cursor mysql connection 
# - go to mysql connector if you have to use the cursor to iterate
#this works unless you need to deal with large datasets

Sub data and get a resultset

from talksql import *
sql="select * from table where column=%s"
data=(value,)
#data is %s sub-ed  
rs,c = xecrs(con,sql,data)
from talksql import *
sql="delete from table"
#data is %s sub-ed if given like resultset  
c = xec(con,sql)
#c is the cursor

Few more

sqlaofa, sqlaofd are experimental and only works as string data

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

talksql-1.2.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

talksql-1.2-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

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