473,729 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cursor.executem any() float error

Data Struct:
from (string), to (string), rate (float)

when i run this:

cursor.executem any('insert into promo (`From`,`To`, `RATE`) \
values (%s,%s,%f)', [ ('AA','BB',10.2 ), ('CC','DD',10.3 ) ] )

i got this error:
TypeError: float argument required

i checked, 10.2 & 10.3 , there are at the right loc.
what went wrong??

Dec 3 '06 #1
2 4212
progman wrote:
cursor.executem any('insert into promo (`From`,`To`, `RATE`) \
values (%s,%s,%f)', [ ('AA','BB',10.2 ), ('CC','DD',10.3 ) ] )

i got this error:
TypeError: float argument required

i checked, 10.2 & 10.3 , there are at the right loc.
what went wrong??
posting a bit more of the traceback, and mentioning what database you're
using might be helpful.

have you tried using "%s" markers for all parameters, btw? (SQL data
binding and %-style string formatting are two different things, after all).

</F>

Dec 3 '06 #2
i am using mysql

i tried the
cursor.executem any('insert into promo (`From`,`To`, `RATE`) \
values (%s,%s,%s)', [ ('AA','BB',10.2 ), ('CC','DD',10.3 ) ] )

and it works.

very strange. isn't it?????

Fredrik Lundh wrote:
progman wrote:
cursor.executem any('insert into promo (`From`,`To`, `RATE`) \
values (%s,%s,%f)', [ ('AA','BB',10.2 ), ('CC','DD',10.3 ) ] )

i got this error:
TypeError: float argument required

i checked, 10.2 & 10.3 , there are at the right loc.
what went wrong??

posting a bit more of the traceback, and mentioning what database you're
using might be helpful.

have you tried using "%s" markers for all parameters, btw? (SQL data
binding and %-style string formatting are two different things, after all).

</F>
Dec 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5051
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works, sometimes not. From mysql: mysql> show databases; +-----------+ | Database |
0
3682
by: Daniel Bowett | last post by:
I seem to have found a bug/limitation of executemany in MySQLdb. I am inserting 3100 records into a database. It works fine and adds them in about 1 second. I went back to the program today and realised i'd missed a field so added it to the insert statement. This seems to break it if I try to add all the records in one go. Through trial and error I have realised the limit is 2786 records in one go. Any more than that I get two...
3
5142
by: robert | last post by:
Mr. Kyte's article doesn't use cursors, while Mr. Feuerstein's book examples do. my recollection of conventional wisdom is to avoid using cursors. is this difference merely a question of style, or is one approach right and the other wrong? oracle 8.1.7
1
1909
by: dinesh prasad | last post by:
I'm simply trying to divide each close1 column by 20, then insert that value into the twentydayMA field. The query keeps on running without finishing, even if I'm only using a single page of data. What could be making this hang? To execute, I'm using exec tad778. I thought about using another cursor to to handle the return values, instead of trying to directly do so using the single cursor. Any ideas? Thanks.. Dinesh
15
3826
by: Philip Mette | last post by:
I am begginner at best so I hope someone that is better can help. I have a stored procedure that updates a view that I wrote using 2 cursors.(Kind of a Inner Loop) I wrote it this way Because I couldn't do it using reqular transact SQL. The problem is that this procedure is taking longer and longer to run. Up to 5 hours now! It is anaylizing about 30,000 records. I think partly because we add new records every month. The procedure...
1
1256
by: Gumby | last post by:
Does anyone know of an c++ code editor with this feature, supposing the cursor is inside functionX(), I'd like to be able to have the search for a string to look only in the scope of the { }. For example, if I search for "variablename" and the cursor is in functionX I only want the search to find the one in functionX and not the one in functionY. But if the cursor is outside any function, then it should search in file scope (anywhere in...
10
2131
by: teddysnips | last post by:
Application is a Work Tracking/Timesheet database. The increments of work are stored in the TimesheetItem table. This contains, inter alia, the Work Code, the Start and the Duration that the employee spent that day on a particular project. Some employees in the Network Support Department don't complete a standard 7.5 hour day for various reasons, so for every Network Support person I need to update these particular days with an amount...
1
2389
by: Paul | last post by:
Hi all, I am making a DirectInput application wich must report correctly the cursor position in windowed mode (it means it has to be the same as Microsoft Window´s cursor position). First of all, I get Windows System Mouse Speed by using the function : SystemParametersInfo(SPI_GETMOUSESPEED, 0, &m_nMouseSpeed,0); After I am reading the last Windows cursor position with GetCursorPos. Then I read all mouse buffered data using...
0
239
by: David | last post by:
You're welcome. executemany is probably a good idea here. If memory becomes a problem at some point (eg: millions of lines) you'll probably want to use an on-disk database (I suggest postgresql), and read in batches of say 1000, which you save to the database with a single executemany. It sounds like your Python code has some serious (algorithm or data
0
8913
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2162
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.