[sqlalchemy] SQLAlchemy and Linked Server (SQL Server)
Hi everyone, I'm trying to access data from a linked server using SQLalchemy (0.9.4), The usual connection established via pyodbc (engine = create_engine( 'mssql+pyodbc://scott:tiger@mydsn')) does not seem to work. Actually I can only read the data with SQL Server using SQL Management Studio and the openquery syntax. I'm totally new to the linked servers world, so what I'm looking for is a starting point to understand if SQLalchemy somehow allows to get access to the data. Any help or suggestion is welcome! Thanks in advance. -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] (ProgrammingError) can interpret 8-bit bytestrings
Hi, I using do SqlAlchemy with python 2.7.6 I came across: sqlalchemy.exc.ProgrammingError: (ProgrammingError) You must not use 8-bit bytes trings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings. u'INSERT INTO algoritimo (nomeAlgoritimo, clas se, estruturaDados, complexidadePiorCaso, complexidadeMedioCaso, complexi dadeMelhorCaso, complexidadeEspacos, pseudoAlgoritimo) VALUES (?, ?, ?, ?, ?, ?, ?, ?)' ('Ordena\xe7\xe3o Sele\xe7\xe3o', 'Algoritmo de oderna\xe7\xe3o', ' Array, Listas ligadas', 'O(n^2)', 'O(n^2)', 'O(n^2)', 'O(n) total, O(1) auxiliar ', '') I use: Base = declarative_base() engine = create_engine('sqlite:///classificacao_pesquisa.db') class Algoritimo(Base): __tablename__ = 'algoritimo' id = Column(Integer, primary_key=True) nomeAlgoritimo = Column(String(50)) classe = Column(String(250)) estruturaDados = Column(String(50)) complexidadePiorCaso = Column(String(50)) complexidadeMedioCaso = Column(String(50)) complexidadeMelhorCaso = Column(String(50)) complexidadeEspacos = Column(String(50)) pseudoAlgoritimo = Column(String(4000)) Do you have any tips? Thank's -- Atenciosamente, Afonso Rodrigues Analista de Sistemas http://linkedin.com/pub/afonso-rodrigues/42/194/270 -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] (ProgrammingError) can interpret 8-bit bytestrings
that's a pysqlite error, not SQLAlchemy, please use Python unicode objects, e.g. u'mystring', for unicode strings. On May 26, 2014, at 1:35 PM, Afonso Rodrigues afonsoaugustovent...@gmail.com wrote: Hi, I using do SqlAlchemy with python 2.7.6 I came across: sqlalchemy.exc.ProgrammingError: (ProgrammingError) You must not use 8-bit bytes trings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings. u'INSERT INTO algoritimo (nomeAlgoritimo, clas se, estruturaDados, complexidadePiorCaso, complexidadeMedioCaso, complexi dadeMelhorCaso, complexidadeEspacos, pseudoAlgoritimo) VALUES (?, ?, ?, ?, ?, ?, ?, ?)' ('Ordena\xe7\xe3o Sele\xe7\xe3o', 'Algoritmo de oderna\xe7\xe3o', ' Array, Listas ligadas', 'O(n^2)', 'O(n^2)', 'O(n^2)', 'O(n) total, O(1) auxiliar ', '') I use: Base = declarative_base() engine = create_engine('sqlite:///classificacao_pesquisa.db') class Algoritimo(Base): __tablename__ = 'algoritimo' id = Column(Integer, primary_key=True) nomeAlgoritimo = Column(String(50)) classe = Column(String(250)) estruturaDados = Column(String(50)) complexidadePiorCaso = Column(String(50)) complexidadeMedioCaso = Column(String(50)) complexidadeMelhorCaso = Column(String(50)) complexidadeEspacos = Column(String(50)) pseudoAlgoritimo = Column(String(4000)) Do you have any tips? Thank's -- Atenciosamente, Afonso Rodrigues Analista de Sistemas -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] (ProgrammingError) can interpret 8-bit bytestrings
but, I use: algoritimo.complexidadeEspacos = u'O(n) total, O(1) auxiliar' but the error continues. 2014-05-26 16:36 GMT-03:00 Michael Bayer mike...@zzzcomputing.com: that’s a pysqlite error, not SQLAlchemy, please use Python unicode objects, e.g. u’mystring’, for unicode strings. On May 26, 2014, at 1:35 PM, Afonso Rodrigues afonsoaugustovent...@gmail.com wrote: Hi, I using do SqlAlchemy with python 2.7.6 I came across: sqlalchemy.exc.ProgrammingError: (ProgrammingError) You must not use 8-bit bytes trings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings. u'INSERT INTO algoritimo (nomeAlgoritimo, clas se, estruturaDados, complexidadePiorCaso, complexidadeMedioCaso, complexi dadeMelhorCaso, complexidadeEspacos, pseudoAlgoritimo) VALUES (?, ?, ?, ?, ?, ?, ?, ?)' ('Ordena\xe7\xe3o Sele\xe7\xe3o', 'Algoritmo de oderna\xe7\xe3o', ' Array, Listas ligadas', 'O(n^2)', 'O(n^2)', 'O(n^2)', 'O(n) total, O(1) auxiliar ', '') I use: Base = declarative_base() engine = create_engine('sqlite:///classificacao_pesquisa.db') class Algoritimo(Base): __tablename__ = 'algoritimo' id = Column(Integer, primary_key=True) nomeAlgoritimo = Column(String(50)) classe = Column(String(250)) estruturaDados = Column(String(50)) complexidadePiorCaso = Column(String(50)) complexidadeMedioCaso = Column(String(50)) complexidadeMelhorCaso = Column(String(50)) complexidadeEspacos = Column(String(50)) pseudoAlgoritimo = Column(String(4000)) Do you have any tips? Thank's -- Atenciosamente, Afonso Rodrigues Analista de Sistemas http://linkedin.com/pub/afonso-rodrigues/42/194/270 -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- Atenciosamente, Afonso Rodrigues Analista de Sistemas http://linkedin.com/pub/afonso-rodrigues/42/194/270 -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] SQLAlchemy and Linked Server (SQL Server)
You need to establish mydsn as an ODBC datasource name. How to do this depends greatly on what platform you're connecting from.Options include: windows: http://technet.microsoft.com/en-us/library/ms188681%28v=sql.105%29.aspx freeTDS: http://www.freetds.org/userguide/prepodbc.htm etc. pyodbc also allows DSN-less connections, see https://code.google.com/p/pyodbc/wiki/ConnectionStrings. Once you get pyodbc to connect, then you can start applying that to SQLAlchemy. On May 26, 2014, at 11:04 AM, Massi massi_...@msn.com wrote: Hi everyone, I'm trying to access data from a linked server using SQLalchemy (0.9.4), The usual connection established via pyodbc (engine = create_engine('mssql+pyodbc://scott:tiger@mydsn')) does not seem to work. Actually I can only read the data with SQL Server using SQL Management Studio and the openquery syntax. I'm totally new to the linked servers world, so what I'm looking for is a starting point to understand if SQLalchemy somehow allows to get access to the data. Any help or suggestion is welcome! Thanks in advance. -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.