thank you Philip, I will test it today.
Greetings Manuel Philip Semanchuk schrieb am Dienstag, 7. Juni 2022 um 17:13:28 UTC+2: > > > > On Jun 7, 2022, at 5:46 AM, Trainer Go <[email protected]> wrote: > > > > Hello guys, > > > > Im executing 2 queries in my python program with sqlalchemy using the > pyodbc driver. > > The database is a Adaptive SQL Anywhere Version 7 32 Bit. > > > > When im executing the queries in a DB UI it takes 5-6 seconds for both > together and when im using the same queries in my python programm it takes > 5-6 minutes instead of 6 seconds. What im doing wrong? Im new at this. > > To start, debug one query at a time, not two. > > Second, when you test a query in your DB UI, you’re probably already > connected to the database. Your Python program has to make the connection — > that’s an extra step, and it might be slow. If you step through the Python > program in the debugger, you can execute one statement at a time (the > connection and the query) to understand how long each step takes. That will > help to isolate the problem. > > Third, keep in mind that receiving results takes time too. If your DB UI > is written in C or some other language that allocates memory very > efficiently, it might be a lot faster than building a Pandas dataframe. > > You might want to eliminate Pandas entirely so you don’t have to question > whether or not that’s the source of your slowdown. You could do this > instead - > > for row in conn.execute(my_query).fetchall(): > pass > > That will force your Python program to iterate over the result set without > being forced to allocate memory for all the results. > > Hope this helps > Philip > > > > > > > > > > would the connection string or query help? > > And i only selecting some datas from the db and converting it into two > dataframes so i dont inserting, updating or deleting datas. > > > > I hope somebody can help me. > > > > Best regards Manuel > > > > -- > > SQLAlchemy - > > The Python SQL Toolkit and Object Relational Mapper > > > > http://www.sqlalchemy.org/ > > > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > > --- > > You received this message because you are subscribed to the Google > Groups "sqlalchemy" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy/b306121e-913c-4ca5-bc2d-6308d76d1b76n%40googlegroups.com > . > > -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/0ec1c104-3771-45ea-b12b-1b1344528064n%40googlegroups.com.
