Questions tagged [fetchall]
165 questions
0
votes
1 answer
SQLAlchemy giving TypeError reading strings from SQLite database
Here is code to read the data out of the tables in a SQLite database:
db_path = 'test.db'
import sqlalchemy as db
engine = db.create_engine('sqlite:///'+db_path)
inspector = db.inspect(engine)
table_names = inspector.get_table_names()
conn =…

Mark Seagoe
- 480
- 8
- 15
0
votes
0 answers
fetchAll from database using PDO
So I've been working on this website a long time but the problem is most of it is MYSQL, which of course isnt very secure, so now I'm trying to update all the PHP to PDO, so far I've only managed to get the connect.php working (in the first code…

Bboi1999
- 1
- 1
- 7
0
votes
0 answers
Result set retrieved with some dbms of postgresql database does not match with php or python result set
I have a strange problem
I'm using a postgresql database, so i've created a function with that return a query with the following data.
Resultset of DBMS
When i want retrieve the data from a programing language how php or python, some rows and cells…
0
votes
1 answer
Get Column names of MySQL table with PDO
I'm trying to write a function that returns an array of column names for a MySQL table.
When I use something like this in HeidiSQL
SELECT COLUMN_NAME FROM information_schema.COLUMNS
WHERE table_schema = 'myDB'
AND TABLE_NAME = 'myTable'
I get…

Tom Hoffman
- 115
- 4
0
votes
2 answers
How to make faster to get large size data from SQL
I am trying to make faster to get large size data from SQL.
Here is my system info.
OS: Linux
Language: python3
SQL library: pymssql
sample code
msg= "SELECT TAG_CODE, UI_X, UI_Y, INSERT_TIME FROM dbo.R_TAG_HIST WHERE "
msg+= "CREATE_TIME >…

djowlrid
- 71
- 1
- 5
0
votes
0 answers
MySQL PDO fetchAll Fetch_Assoc losing some columns
I am returning a short array via:
return $stmt->fetchAll( PDO::FETCH_ASSOC );
and running into a very strange issue. In my test case, I have three rows of data. Each row has a unique ID, a processed flag, and a content varchar:
`incomingstring`…

Gerdofal
- 91
- 7
0
votes
1 answer
Python3 sqlite3 query issues: no erros, but c.fetchall and rowcount is null
mport sqlite3
from itertools import groupby
aes_fault_db = r'C:\Users\Desktop\Jetwave Cases\9V-SHD_20200313_0007\AES\Maintenance\AESFault_1.sqlite3'
def create_connection(aes_fault_db):
try:
conn = sqlite3.connect(aes_fault_db)
except Error as…

Joe
- 1
- 1
0
votes
1 answer
(Flask) How to modify list after a fetchall
(sorry for my very bad english !... ^^)
Hello everyone
I make a def in my flask to keep with my fetchall a list.
But i need to add a parameters in my list to do something.
I need to add in list[4]
However, i don't know how i can do this ...
#…

uPong
- 29
- 6
0
votes
1 answer
Python mysql fetchall() returns additional characters
I am trying to retrieve values from a table to use in a calculation. The code below
mycursor = mydb.cursor()
mycursor.execute("SELECT number FROM info")
rows = mycursor.fetchall()
print (rows)
This returns this list
[(Decimal('30.00'),),…

user1415396
- 3
- 1
0
votes
1 answer
Through python when connecting MySQL and assign vales to variables, datatype changed from 'int' to 'tuple'
Comparatively new in both python and mysql.
I have solved the issue, but want to know the reason. If I use 'comma' after assigning the values to the variables, then it is changing the next datatype from 'int' to 'tuple'. For sting it is not. If I…

Fakir
- 139
- 11
0
votes
1 answer
django print all record in the cmd but display the last one on template
i have a function that retrieve data from sql server database where i am using fetchall() then for loop
the retrieved data are all printed on the cmd console but when i tried to display these result on the template it only display the last…

Dev Dj
- 169
- 2
- 14
0
votes
1 answer
appending tuple list from one to another
I am creating a UI where I grab a set of data from an SQL database file and inserting it to a Listbox. I am using Tkinter framework. I'm having an issue where I want to append the tuples onto another empty array so I can append a limited amount of…

brian012
- 193
- 1
- 2
- 12
0
votes
1 answer
setFetchMode() seems not to be working and not returning an object?
I'm currently working with one of my friends on making a portfolio for all of his projects and as strangely as it seems, I cannot manage to make setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Class Namespace') working on his code while it…

Virginie P.
- 33
- 5
0
votes
1 answer
MySQL PDO fetchAll as array with format
I have this PDO code
function getAllUserTicketHistoryJson($rid){
global $conn;
$stmt = $conn->prepare("SELECT user_id, total_ticket FROM lottery_user WHERE round_id = :rou");
$stmt->bindParam(':rou', $rid);
$stmt->execute();
…

Investor Support
- 11
- 4
0
votes
1 answer
PDO storing FetchAll result in variable vs using directly in foreach
So curiosity got to me. I always try to avoid creating variables that will only be used once, instead I try to use it directly (unless it's a lot of text, for example MySQL queries).
What I usually do is something like this:
$getSomethingSql = 'LONG…

Joshua Bakker
- 2,288
- 3
- 30
- 63