Re: pymssql

2016-09-11 Thread sum abiut
Thanks heaps for your comments, manage to get it work using the as_dict` parameter of the `cursor` object, cus=conn.cursor(as_dict=True) cus.execute("SELECT budget_code,budget_description,rate_type FROM glbud") for row in cus: print(row['budget_code'],row['budget_description'],row['rate_type']

Re: pymssql

2016-09-09 Thread Miki Tebeka
> for row in cus: >print(row.budget_code) > > > NameError: name 'budget_code' is not defined You'll need to use a DictCursor to be able to access rows by name and not position (which IMO is the preferred way). cus = conn.cursor(pymysql.cursors.DictCursor) cus.execute("SELECT * FROM

Re: pymssql

2016-09-08 Thread sum abiut
ok did some changes: conn=pymssql.connect(server,username,password,database) cus=conn.cursor( cus.execute("SELECT budget_code,budget_description,rate_type FROM glbud") for row in cus: print(row) the above code display the selected column but when i iterate and try to print the fields, its

Re: pymssql

2016-09-08 Thread Lawrence D’Oliveiro
On Friday, September 9, 2016 at 12:48:50 PM UTC+12, sum abiut wrote: > cus.execute("SELECT * FROM glbud ") Never use “select *”, except for testing. > for row in cus: >print(row) > this works perfect, but when i try to iterate through and only print out > specific fields i got

pymssql

2016-09-08 Thread sum abiut
Hi, i have used pymssql to connet to windows database but i want to be able iterate and only print out some specific fields. here is what i did conn=pymssql.connect(server,username,password,database) cus=conn.cursor() cus.execute("SELECT * FROM glbud ") for

Re: Can not get the result of query in pymssql module of python...

2012-02-09 Thread Rod Person
nstalled following modules & softwares in python 2.7 : > > python 2.7.2 > setuptools > MySQLdb Module > pymssql module > yum install mysql msql-devel freetdf > > I have installed freetds 0.9version. After installation of all the > above components, I have done fo

Can not get the result of query in pymssql module of python...

2012-02-08 Thread amarjeet yadav
QLdb Module pymssql module yum install mysql msql-devel freetdf I have installed freetds 0.9version. After installation of all the above components, I have done following things Python 2.6 (r26:66714, Apr 8 2010, 08:46:35) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 Type "help&quo

Re: Installing pymssql

2010-08-23 Thread Thomas Jollans
On Monday 23 August 2010, it occurred to f1crazed to exclaim: > Hello, > > I am new to the python world. I'm trying the install the pymssql > package and have been unsuccessful. I am running Win7 x64. Here is > the output I get when I try to build the pymssql package:

Installing pymssql

2010-08-23 Thread f1crazed
Hello, I am new to the python world. I'm trying the install the pymssql package and have been unsuccessful. I am running Win7 x64. Here is the output I get when I try to build the pymssql package: running build running build_ext cythoning _mssql.pyx to _mssql.c building '_mssql&

SQLalchemy+py2exe+pymssql error

2010-07-21 Thread Massi
Hi everyone, I'm trying to build an executable with py2exe. My script uses SQLalchemy and pymssql with python 2.6. Here is my setup file: from distutils.core import setup import py2exe manifest = """ myProgram """

Re: pymssql text type

2009-03-12 Thread marc wyburn
On Mar 12, 3:36 pm, a...@pythoncraft.com (Aahz) wrote: > [posted and e-mailed, please reply to group] > > In article <851ed9db-2561-48ad-b54c-95f96a7fa...@q9g2000yqc.googlegroups.com>, > marcwyburn  wrote: > > >Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the > >follwoing error

Re: pymssql text type

2009-03-12 Thread Aahz
[posted and e-mailed, please reply to group] In article <851ed9db-2561-48ad-b54c-95f96a7fa...@q9g2000yqc.googlegroups.com>, marc wyburn wrote: >Hi, I'm trying to pass a text blob to MS SQL Express 2008 but get the >follwoing error. > >(, OperationalError("SQL Server >message 102, severity 15, st

pymssql text type

2009-02-20 Thread marc wyburn
taking place hence the string is being read but I can work out whether I need to character encode in Python, change a table setting in SQL or do something to pymssql. Thanks, Marc. -- http://mail.python.org/mailman/listinfo/python-list

Re: pymssql for python 2.6 ?

2008-12-19 Thread M�ta-MCI (MVP)
Hi! Look at http://www.mayukhbose.com/python/ado/ado-connection.php That run OK with Python 2.6 @-salutations -- MCI -- http://mail.python.org/mailman/listinfo/python-list

pymssql for python 2.6 ?

2008-12-19 Thread TkNeo
when would pymssql come out with a release that is compatible with python 2.6 ? Thanks -TK -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems Writing £ (pound sterling) To MS SQLServer using pymssql

2008-11-27 Thread Darren Mansell
>> sql = "select * from table_1" > >>> cur.execute(sql) > >>> cur.fetchall() > [('\xc2\xa3',), ('1',)] > > If I insert a £ symbol in using SQL management studio then select it back > from Python I get this: > > [(&#x

Re: Problems Writing £ (pound sterling) To MS SQL S erver using pymssql

2008-11-17 Thread MRAB
; >>> sql = "select * from table_1" > >>> cur.execute(sql) > >>> cur.fetchall() > > [('\xc2\xa3',), ('1',)] > > If I insert a £ symbol in using SQL management studio then select it back > from Python I get this: &g

Re: Problems Writing £ (pound sterling) To MS SQL Server using pymssql

2008-11-17 Thread J. Cliff Dyer
in stone, I can't do anything with it. I'm > currently opening autogenerated SQL scripts, decoding them from utf-16 > and then back into utf-8 for pymssql to run them. > > It's been working great for ages until someone noticed the £ symbols had > this extra character

Re: Problems Writing £ (pound sterling) To MS SQL Server using pymssql

2008-11-17 Thread Darren Mansell
for the help. Unfortunately pyodbc seems to only work on Windows. I need to connect to the SQL server from a Linux box. The db schema is very set in stone, I can't do anything with it. I'm currently opening autogenerated SQL scripts, decoding them from utf-16 and then back into utf-8 for pyms

Re: Problems Writing £ (pound sterling) To MS SQL Server using pymssql

2008-11-17 Thread J. Cliff Dyer
>>> sql = "select * from table_1" > >>> cur.execute(sql) > >>> cur.fetchall() > [('\xc2\xa3',), ('1',)] > > If I insert a £ symbol in using SQL management studio then select it back > from Python I get this: > > [('

Re: Problems Writing £ (pound sterling) To MS SQL Server using pymssql

2008-11-17 Thread Tim Golden
TE TABLE b (x NVARCHAR (1))") db.execute ("INSERT INTO b (x) VALUES (?)", ['£']) db.execute ("INSERT INTO b (x) VALUES (?)", [u'£']) db.execute ("COMMIT") for x, in db.execute ("SELECT x FROM b"): print repr (x), unicodedata.name (x[0]) [*

Problems Writing £ (pound sterling) To MS SQL Server using pymssql

2008-11-17 Thread Darren Mansell
If I insert a £ symbol in using SQL management studio then select it back from Python I get this: [('\xc2\xa3',), ('1',), ('\xa3',)] If I look in SQL management studio it says this: £ for the inserts I do through Python/pymssql. Does anyone have any ideas whats happening and how to fix it? Thanks -- Darren Mansell <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

pymssql stored procedures - NEW THREAD

2008-10-21 Thread Aspersieman
On Tue, 21 Oct 2008 20:44:24 +0200, Mike Hansen <[EMAIL PROTECTED]> wrote: Hi, I saw your posting on the python list about pymssql and you mentioned that you call stored procedures and get back output parameters. Are you doing this on Windows or Linux? I can't seem to get it

Re: pymssql - execute loads all results into memory!

2008-10-21 Thread Tim Golden
Aspersieman wrote: [... re output params in pymssql / pyodbc ...] Oh, trust me - I've tried a *LOT*. I aggree, submitting a feature request is a good idea. I think I'll do that. :) Looks like someone already has: http://sourceforge.net/tracker/index.php?func=detail&aid=19

Re: pymssql - execute loads all results into memory!

2008-10-21 Thread Aspersieman
On Tue, 21 Oct 2008 13:06:37 +0200, Tim Golden <[EMAIL PROTECTED]> wrote: Aspersieman wrote: However, pyODBC doesn't support return variables(parameters) in stored procedures (at least with MS SQL). pymssql is the only db api for python that I've found that can reliab

Re: pymssql - execute loads all results into memory!

2008-10-21 Thread Tim Golden
Aspersieman wrote: However, pyODBC doesn't support return variables(parameters) in stored procedures (at least with MS SQL). pymssql is the only db api for python that I've found that can reliably do this. I've tried adodbapi, pyodbc and one or two others (can't th

Re: pymssql - execute loads all results into memory!

2008-10-21 Thread Aspersieman
On Tue, 21 Oct 2008 10:14:56 +0200, ChaosKCW <[EMAIL PROTECTED]> wrote: On Oct 20, 3:38 pm, Tim Golden <[EMAIL PROTECTED]> wrote: Eric Wertman wrote: >> I am trying to use pymssql, and have an issue where by the execute >> (not the fetch) is appearing to load all recor

Re: pymssql - execute loads all results into memory!

2008-10-21 Thread ChaosKCW
On Oct 20, 3:38 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > Eric Wertman wrote: > >> I am trying to use pymssql, and have an issue where by the execute > >> (not the fetch) is appearing to load all records into memory. > > >> if I execute > > >&g

Re: pymssql - execute loads all results into memory!

2008-10-20 Thread Tim Golden
Eric Wertman wrote: I am trying to use pymssql, and have an issue where by the execute (not the fetch) is appearing to load all records into memory. if I execute con = pymssql.connect(...) cur = con.cursor() cur.execute(sql) rec = cur.fetchone() if I put in a query which returns a lot of

Re: pymssql - execute loads all results into memory!

2008-10-20 Thread Eric Wertman
> I am trying to use pymssql, and have an issue where by the execute > (not the fetch) is appearing to load all records into memory. > > if I execute > > con = pymssql.connect(...) > cur = con.cursor() > cur.execute(sql) > rec = cur.fetchone() > > if I put

pymssql - execute loads all results into memory!

2008-10-20 Thread ChaosKCW
Hi I am trying to use pymssql, and have an issue where by the execute (not the fetch) is appearing to load all records into memory. if I execute con = pymssql.connect(...) cur = con.cursor() cur.execute(sql) rec = cur.fetchone() if I put in a query which returns a lot of records into &quo

Re: no mistake but i didnt get what i want (with python module pymssql send information to the mssql)

2008-10-17 Thread Peter Otten
[EMAIL PROTECTED] wrote: > On 10月17日, 下午6时41分, Peter Otten <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >> > the code is below: >> > import pymssql >> > conn = pymssql.connect(host = "121.198.126.233",user = "",password &

Re: no mistake but i didnt get what i want (with python module pymssql send information to the mssql)

2008-10-17 Thread gdyren
On 10月17日, 下午6时41分, Peter Otten <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > the code is below: > > import pymssql > > conn = pymssql.connect(host = "121.198.126.233",user = "",password > > = "",database =

Re: no mistake but i didnt get what i want (with python module pymssql send information to the mssql)

2008-10-17 Thread gdyren
On 10月17日, 下午6时41分, Peter Otten <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > the code is below: > > import pymssql > > conn = pymssql.connect(host = "121.198.126.233",user = "",password > > = "",database =

Re: no mistake but i didnt get what i want (with python module pymssql send information to the mssql)

2008-10-17 Thread Peter Otten
[EMAIL PROTECTED] wrote: > the code is below: > import pymssql > conn = pymssql.connect(host = "121.198.126.233",user = "",password > = "",database = "test") > print "connecting success" > cursor = conn.cursor() > cu

no mistake but i didnt get what i want (with python module pymssql send information to the mssql)

2008-10-17 Thread gdyren
the code is below: import pymssql conn = pymssql.connect(host = "121.198.126.233",user = "",password = "",database = "test") print "connecting success" cursor = conn.cursor() cursor.execute("insert into bbs_test values(%s,%s,%s,

Re: Can't use DB name with dashes using pymssql ???

2008-08-13 Thread Fredrik Lundh
Fredrik Lundh wrote: reading the documentation might help: http://pymssql.sourceforge.net/troubleshooting.html#dbid also see the SQL server reference documentation (the section "Rules for Regular Identifiers" describes the valid syntax): http://msdn.microsoft.com/en-us/library/ms17

Re: Can't use DB name with dashes using pymssql ???

2008-08-13 Thread Fredrik Lundh
Samuel Morhaim wrote: I believe there is a bug in Python.. _mssql ...I am not too familiar with Python yet, but after adding several breakpoints and watching the variable, the last step of pymssql.py is # open the connection con = _mssql.connect(dbhost, dbuser, dbpasswd) con

Re: Can't use DB name with dashes using pymssql ???

2008-08-13 Thread Samuel Morhaim
; > please help... thanks. > > > > On Wed, Aug 13, 2008 at 4:54 PM, Samuel Morhaim <[EMAIL PROTECTED]>wrote: > >> I tried: >> >> import sys >> import pymssql >> >> db = 'Gcare4UI-B6_3_dev' >> >> conn = pymssql.connec

Re: Can't use DB name with dashes using pymssql ???

2008-08-13 Thread Samuel Morhaim
(of course because the DB without the - doesnt exist... ) please help... thanks. On Wed, Aug 13, 2008 at 4:54 PM, Samuel Morhaim <[EMAIL PROTECTED]>wrote: > I tried: > > import sys > import pymssql > > db = 'Gcare4UI-B6_3_dev' > > conn = pymssql.conne

Can't use DB name with dashes using pymssql ???

2008-08-13 Thread Samuel Morhaim
I tried: import sys import pymssql db = 'Gcare4UI-B6_3_dev' conn = pymssql.connect (host = "localhost", user = "myname", password = "mypassword", database = db) And this return

Re: Chinese character become ??? by pymssql or pyodbc

2008-04-14 Thread Jeroen Ruigrok van der Werven
-On [20080414 10:31], James Su ([EMAIL PROTECTED]) wrote: >But when I query those data by pymssql or pyodbc, all Chinese >Character display ??? instead. Sounds like you are getting typical Unicode replacement characters. -- Jeroen Ruigrok van der Werven / asmodai イェルーン ラウフロック ヴァン デル

Chinese character become ??? by pymssql or pyodbc

2008-04-14 Thread James Su
I tried to use pymssql to access MSSQL 2000, with a table, I store Chinese Character in NVarchar field, Chinese Character display normally when I query them by MS SQL Query Analyzer under Windows or by unixODBC under Ubuntu. But when I query those data by pymssql or pyodbc, all Chinese Character

Re: encoding/decoding issue with python2.5 and pymssql

2008-03-24 Thread Rob Williscroft
Tzury Bar Yochay wrote in news:3a6c32fe-e7c1-4230-882d-efb3415196c1 @b1g2000hsg.googlegroups.com in comp.lang.python: > for example: > the value > 'EE604EE3-4AB0-4EE7-AF4D-018124393CD7' > is represent as > '\xe3N`\xee\xb0J\xe7N\xafM\x01\x81$9<\xd7' > from uuid import * u = UUID( bytes = '\xe3N`

Re: encoding/decoding issue with python2.5 and pymssql

2008-03-24 Thread Tzury Bar Yochay
These are not cut&paste but typed by hand, yet they are identical to the actual output. seems like the first 8 bytes are swapped while the other half is straightforward. I deeply thank you for your assistance. I am currently using a combination of reversed and list comprehension to rebuild this b

encoding/decoding issue with python2.5 and pymssql

2008-03-23 Thread Tzury Bar Yochay
hi, in my table the field row_id is type of uniqueidentifier. when try to fetch the data, pymssql somehow, encodes the values in a way which yields odd results. for example: the value 'EE604EE3-4AB0-4EE7-AF4D-018124393CD7' is represent as '\xe3N`\xee\xb0J\xe7N\xafM\x01\x81$9<\

Re: Inserting NULL values with pymssql

2008-02-21 Thread Steve Holden
at it is a rookie mistake. Below is > a test I came up with to prove this. I am on Windows XP using Python 2.5 > and pymssql-0.8.0-py2.5. > > CREATE TABLE [dbo].[Test]( > [test] [varchar](50) NULL, > [inttest] [int] NULL > ) ON [PRIMARY] > > 1. > import pymss

RE: Inserting NULL values with pymssql

2008-02-21 Thread Jayson Barley
I also forgot to mention that this... import pymssql TestDB = pymssql.connect(host='Test',user='test',password='test',database='test') cursor = TestDB.cursor() query = """INSERT INTO test.dbo.test (test) VALUES ('%s');"&qu

Inserting NULL values with pymssql

2008-02-21 Thread Jayson Barley
came up with to prove this. I am on Windows XP using Python 2.5 and pymssql-0.8.0-py2.5. CREATE TABLE [dbo].[Test]( [test] [varchar](50) NULL, [inttest] [int] NULL ) ON [PRIMARY] 1. import pymssql TestDB = pymssql.connect(host='Test',user='test',password='

Re: pymssql - insert NULL to int

2007-10-18 Thread Diez B. Roggisch
params. One of the values in the params is a NULL value going to int >> > field. The pymssql._quote() puts ' around the NULL which causes an >> > exception to be thrown, is there a way to use the params for this or >> > do I need to build the insert string myself?

Re: pymssql - insert NULL to int

2007-10-17 Thread rc
params is a NULL value going to int > > field. The pymssql._quote() puts ' around the NULL which causes an > > exception to be thrown, is there a way to use the params for this or > > do I need to build the insert string myself? > > > pymssql.DatabaseEr

Re: pymssql - insert NULL to int

2007-10-17 Thread Diez B. Roggisch
rc wrote: > How to insert NULL values in to int field using params. > > I'm trying to use pymssql.execute, passing the operation and list of > params. One of the values in the params is a NULL value going to int > field. The pymssql._quote() puts ' around the NULL wh

pymssql - insert NULL to int

2007-10-17 Thread rc
How to insert NULL values in to int field using params. I'm trying to use pymssql.execute, passing the operation and list of params. One of the values in the params is a NULL value going to int field. The pymssql._quote() puts ' around the NULL which causes an exception to be thrown,

Re: pymssql query

2007-05-16 Thread Tim Golden
[EMAIL PROTECTED] wrote: > Hi, > > I'm trying to use pymssql to execute a stored procedure. Currently, I > have an Excel spreadsheet that uses VBA in this manner: > > Private Function CreateNewParrot(connDb As ADODB.Connection) As Long > Dim objCommand As ADODB.Comma

pymssql query

2007-05-16 Thread m . biddiscombe
Hi, I'm trying to use pymssql to execute a stored procedure. Currently, I have an Excel spreadsheet that uses VBA in this manner: Private Function CreateNewParrot(connDb As ADODB.Connection) As Long Dim objCommand As ADODB.Command Dim iParrot As Long Dim bSuccess As Boolean

Strange string encoding behaviour with pymssql

2006-09-01 Thread Fabrizio Cornelli
Hello,  I'm using pymssql to extract data from a legacy table with a non-ascii encoded name. The strange thing is that I can make my query from the idle's console, but it doesn't work from python. (I'm working in a windows environment) The error shows that there's a proble

Re: pymssql and date format

2006-02-17 Thread Steve Holden
[EMAIL PROTECTED] wrote: > hi > i am using pymmsql to query a date column in MSSQL database table. > However the result shows for example > (datetime.datetime(2006, 2, 16, 17, 50, 19) which is supposed to be > 2006-02-16 17:50:19.000 > anyway to correct query a date column using

pymssql and date format

2006-02-16 Thread eight02645999
hi i am using pymmsql to query a date column in MSSQL database table. However the result shows for example (datetime.datetime(2006, 2, 16, 17, 50, 19) which is supposed to be 2006-02-16 17:50:19.000 anyway to correct query a date column using pymssql so that it gives the correct date format

Re: encoding problems with pymssql / win

2006-02-11 Thread morris carre
> (to email use "boris at batiment71 dot ch") oops, that's "boris at batiment71 dot net" -- http://mail.python.org/mailman/listinfo/python-list

encoding problems with pymssql / win

2006-02-11 Thread morris carre
I have a strange problem : some code that fetches queries from an mssql database works fine under Idle but the very same code run from a shell window obtains its strings garbled as if the encoding codepage was modified. This occurs only when using pymssql to connect; if I connect through odbc

pymssql and bind variables

2005-09-23 Thread Albert Leibbrandt
I need to write a little app that connects to an MS SQL server and for this I decided on the pymssql module. At this stage I am trying to find out if MS SQL server can handle bind variables. If anybody can give me an answer and perhaps a example it will be appreciated   Thanks Albert

How to change pymssql timeout value?

2005-08-07 Thread saqib
I have a query that is running on a mssql DB that takes about 15 minutes when run "directly"; IE: thru MS SQL Query Analyzer. I know, it sucks. I'm trying to fix it. But in the meantime, I have a python process which connects to the DB using pymssql. This process runs the afor