Skip to content
Advertisement

Tag: python

How can I return multiple rows in AsyncPG?

Let’s say I have a table with the following format: favoritefood favoritedrink pizza water ice cream orange juice pizza milk How would I return both rows with pizza as the favorite food with Python? I have fetchrow implemented for other functions, but it only works for one row, of course. Ideally, they would be sorted into dictionaries (ex: {favoritefood: pizza,

Passing parameters from Python to SQL Server

I have code like this: I am getting this error: ‘The SQL contains 1 parameter markers, but 2 parameters were supplied’, ‘HY000’ Is there any way to pass this parameter? I don’t want to create a dynamic array by concatenation. Is there any way to name the parameter marker inside the query in case of several where conditions? Answer If

SQLite – Combining Rows into New Columns

I am attempting to create a chatbot in Python 3.9 using my own text messages, but am having trouble formatting my data correctly. I have a table of text messages that looks like this: row_id Type Date Text 1 Incoming 2020-08-10 08:09:18 Hi 2 Outgoing 2020-08-10 08:11:04 Hello 3 Incoming 2020-08-10 08:11:12 For tomorrow 4 Incoming 2020-08-10 08:11:20 Are we

Advertisement