python_starter
python_starter

Reputation: 1551

python sql query stating 'not enough input arguments'

In order to select the price of an item I have the following code:

product = ['user_input']
item(product)
day = int(self.ui.spinBox.value())

query = 'select price from (select * from %s order by count limit %d) order by count as limit desc'

sql = query % item % day

In response I get the error that there aren't enough input arguments.

Upvotes: 1

Views: 139

Answers (1)

Samuel
Samuel

Reputation: 3801

you have to specify multiple arguments as tuple, eg:

sql = query % (item, day)

Upvotes: 1

Related Questions