On Sun, Jan 7, 2018 at 9:07 PM, Russ Wilson <rpwil...@gmail.com> wrote: > I noticed if you use the cursor.fetchmany it returns the pyodbc types. Is > this an issue with the dialect? if you use the connection execute you are > correct it returns a resultrow. Thanks for the help. > > cursor = connection.cursor() > cursor.execute("SELECT * FROM mytable") > results_one = cursor.fetchmany(100) > for row in results_one: > print(type(row))
It's not an issue, when you call SQLAlchemy's fetchmany(), it is internally retrieving the pyobc row objects and converting them to ResultRow objects. As I mentioned before, we have three dialects that use Pyodbc and two are production quality, same API, same row objects, etc. > > > On Sunday, January 7, 2018 at 12:01:29 PM UTC-6, Mike Bayer wrote: >> >> >> >> On Jan 7, 2018 11:29 AM, "Russ Wilson" <rpwi...@gmail.com> wrote: >> >> When I attempt to create a panda dataframe from the results it throws this >> error "Shape of passed values is (1, 100), indices imply (9, 100)" because >> it is seeing the results as 1 column vs a list of columns. Ill take a look >> at the SQL Server one. Thanks >> >> >> That has nothing to do with a SQLAlchemy dialect because all SQLAlchemy >> result sets come back as a ResultSet object and every row is a ResultRow. >> The pyodbc internals are not exposed. >> >> >> >> pd.DataFrame(data=data, columns=column_names) >> >> >> >> On Saturday, January 6, 2018 at 11:57:57 PM UTC-6, Mike Bayer wrote: >>> >>> pyodbc.Row acts like a tuple so there is no special conversion needed. >>> >>> SQLAlchemy has three pyodbc dialects, for SQL Server (very stable), >>> MySQL (sorta works), and Sybase (probably doesn't work), but you can >>> use the first two as examples for the basics. They base off of the >>> PyODBCConnector in connectors/pyodbc.py. >>> >>> >>> On Sun, Jan 7, 2018 at 12:40 AM, Russ Wilson <rpwi...@gmail.com> wrote: >>> > >>> > I was attempting to create a new dialect but hit and issue. pyodbc is >>> > returning a list of pyodbc.Row. Is there a method i should be >>> > implementing >>> > to convert the list to a list of tuples. >>> > >>> > Thanks >>> > >>> > -- >>> > 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 sqlalchemy+...@googlegroups.com. >>> > To post to this group, send email to sqlal...@googlegroups.com. >>> > Visit this group at https://groups.google.com/group/sqlalchemy. >>> > For more options, visit https://groups.google.com/d/optout. >> >> -- >> 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 sqlalchemy+...@googlegroups.com. >> To post to this group, send email to sqlal...@googlegroups.com. >> Visit this group at https://groups.google.com/group/sqlalchemy. >> For more options, visit https://groups.google.com/d/optout. >> >> > -- > 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 sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.