Hi,
I'm trying to issue a query in SQL Server via select(cols, cond, ...) and I
would like to add collation at query execution time for executing the query
in a case sensitive mode.
I tried this:
cond = and_(tab.c.col3=="mystring1", tab.c.col2=="mystring2")
cond = cond.collate("SQL_Latin1_Gener
HI everyone,
I'm trying to use sqlalchemy (0.9.10) to retrieve the number of rows of
table in PostgreSQL, here a stub of the code:
import sqlalchemy
from sqlalchemy import select, create_engine, MetaData, Table, Column
import datetime
engine =
create_engine('postgresql+pg8000://postgres:passwo
/orm/extensions/declarative/table_config.html#using-reflection-with-declarative
>
>
> Simon
>
> On Thu, Sep 3, 2015 at 3:54 PM, Massi >
> wrote:
> > Hi Simone,
> >
> > thank you for your reply. Unfortunately I don't create the table so I
> don
3, 2015 at 1:05 PM, Massi >
> wrote:
> > Hi everyone,
> >
> > I'm trying to use sqlalchemy (0.9.10) to read a sqlite table which
> contains
> > some datetime columns. As the title says these column are given in the
> > format -MM-DDTHH:mm:ss (I
Hi everyone,
I'm trying to use sqlalchemy (0.9.10) to read a sqlite table which contains
some datetime columns. As the title says these column are given in the
format -MM-DDTHH:mm:ss (I did not create the table). When I execute the
query, it succeeds, but when I try to convert the rows to l
It works! Thanks a lot!
On Tuesday, September 1, 2015 at 5:42:08 PM UTC+2, Michael Bayer wrote:
>
>
>
> On 9/1/15 11:28 AM, Massi wrote:
>
> Hi everyone,
>
> I'm trying to manage read and write operations of utf-8 unicode strings
> with SQL Server (sqlalch
Hi everyone,
I'm trying to manage read and write operations of utf-8 unicode strings
with SQL Server (sqlalchemy 0.9.10), but I'm having some problems. I
correctly write the strings to the database, but when I read them back and
try to convert to unicode I get the following error:
Traceback (m
Hi everyone,
I'm trying to use oursql module with sqlalchemy (0.9.10) for managing a
table with TIME columns, but I'm encountering an error, here a code snippet
showing the problem:
import sqlalchemy
from sqlalchemy import select, create_engine, MetaData, Table, Column
import datetime
engine =
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
Hi, I'm experiencing a similar problem in my program (Sqlalchemy 0.8.4).
In my case no blob column is involved, the problem seems to be related to
presence of a foreign key in the target table. Here is the traceback of the
error:
File "C:\Python27\lib\site-packages\sqlalchemy\orm\session.py"
Hi everyone,
in my script I'm using column_mapped_collection to create a collection
indexed by a column of a certain table. This is an example scenario (pseudo
code):
class Parent(object):
def __init__(self):
# define some fileds
def AddChild(self, new_child):
self.ch
Hi everyone, as the title says I'm trying to run sqlalchemy (pyodbc) with
SQL Server 2008 on Windows Server 2008 R2 sp1 but I'm failing with the
database connection. Here is a small script I'm using to test the
connection:
from sqlalchemy import *
from sqlalchemy.engine import reflection
url =
)
which substitutes the first double quotes with a blank. Is this really
necessary? Does there exist any workaround to overcome this problem?
Il giorno martedì 18 settembre 2012 18:21:36 UTC+2, Massi ha scritto:
>
> Hi everyone, I'm using sqlalchemy 0.7.8 with sqlite and I'm encounte
Hi everyone, I'm using sqlalchemy 0.7.8 with sqlite and I'm encountering a
problem trying to retrieve data from a table having a column named
"input"_1. If I run this simple code:
from sqlalchemy import *
db = create_engine('sqlite:///test.db')
db.echo = False
metadata = MetaData(db)
t = Table
m not sure that the resulting vector is ordered. Am I wrong?
Other Ideas?
On 25 Apr, 16:11, Wichert Akkerman wrote:
> On 04/25/2012 03:57 PM, Massi wrote:
>
>
>
>
>
>
>
>
>
> > Hi everyone,
>
> > in my script I have to deal with a huge database wit
Hi everyone,
in my script I have to deal with a huge database with thousands of
tables. Given a table name (a python string) I would have to now if
such a table exists or not. Up to now I have written this function:
def DBGetTableByName(table_name) :
metadata = MetaData(engine)
tr
'postfetch' error.
On 18 Ago, 19:34, Michael Bayer wrote:
> On Aug 18, 2011, at 1:19 PM, Massi wrote:
>
>
>
>
>
>
>
>
>
> > I got:
>
> > File "C:\Python26\lib\site-packages\sqlalchemy-0.7.2-py2.6-win32.egg
> > \sqlalchemy\engine\base.py&
'MSSQLCompiler' object
has no attribute 'postfetch') 'INSERT INTO...'
On 18 Ago, 19:08, Michael Bayer wrote:
> On Aug 18, 2011, at 1:06 PM, Massi wrote:
>
>
>
>
>
>
>
>
>
> > I changed the code to (SA 0.7.2 with pyodbc2.1.9):
&g
, in _init_compiled
self._is_explicit_returning = compiled.statement._returning
StatementError: 'InsertFromSelect' object has no attribute
'_returning' (original cause: AttributeError: 'InsertFromSelect'
object has noattribute '_returning') 'INSERT INTO...&
Hi everyone, I'm trying to implement an InsertFromSelect workaround to
handle the identity insert issue of SQL server. This is more or less
what I'm doing:
class InsertFromSelect(Executable, ClauseElement) :
def __init__(self, table, select) :
self.table = table
self.select = s
Hi everyone,
I'm doing some test to evaluate the performance of querying with
sqlalchemy via ORM. I wrote a simple script to measure the execution
time of a simple select query made on relatively small table (300 000
records, 6 columns) in sqlite. Here is the script:
from sqlalchemy import *
from
Hi everyone,
in my script I work with two different sessions (say session1 and
session2) bounded to the same database and, consequently, with ORM
objects obtained with queries issued on them. It can occur that an
object related to session1 change a value of the corresponding mapped
table record an
Hi everyone, I'm using sqlalchemy 0.6.8 to interact with an sql server
database via pyodbc. I'm getting in troubles using the 'order by'
clause on a varchar column which include positive or negative integer
values. When I try to get values from this column ordered in ascending
mode I get:
1
-1
11
Hi everyone, I'm writing a script using sqlalchemy 0.66 and sqlite3.
In my script I'm trying to set up a one to one relation between two
tables via ORM. Here is a simplified code showing my situation:
from sqlalchemy import *
from sqlalchemy.orm import *
class Parent(object) :
def __init__(se
Hi everyone, I'm writing a script using sqlalchemy 0.66 and sqlite3.
I'm encountering a problem trying to create and load a table from two
different engines.
Here is an example script showing the problem:
from sqlalchemy import *
engine1 = create_engine("sqlite:///test.db", echo=False)
metadata1
Hi everyone, I'm using sqlalchemy 0.6.6 with SQLite...my problem is
simple, is there a way to compute standard deviation in sqlalchemy
with SQlite as a backend? I googled and found that native SQLite does
not support any aggregate function like MySQL 'stdev', but there exist
some extensions which c
Hi everyone, I'm trying to access a Firebird (version 2.5) database
through Kinterbasdb under windows 7 with python 2.6. I'have download
the file:
kinterbasdb-3.3.0.win32-py2.6.msi
which can be found at this link:
http://www.firebirdsql.org/index.php?op=devel&sub=python,
but when I try to instal
Hi everyone, in my script (python 2.6, Oracle10g, cx_oracle 5.0.4,
sqlalchemy 0.6.5) I'm running the following simple query on one of my
tables:
table = Table("my_data_table", metadata, autoload=True)
col = getattr(table.c, "my_integer_col")
res = select(func.stdev(col)).execute().fetchone()
wher
Hi everyone, in my script I have to deal with a table whose number of
columns can change at runtime. Since I have no information about the
structure I will have to handle at a given moment, I would need to
change dynamically the mapping during the program. If I try to re-map
the table I obviously g
Ok, the title doesn't say much, so I'll try to explain my problem with
an example:
I have two classes:
class A(object) :
pass
class B(object) :
pass
which are bounded by a relation:
a_tab = Table(...)
b_tab = Table(...)
b_tab.append_constraint(ForeignKeyConstraint([a_tab.c.id],
[b_tab.
Hi everyone, I'm getting in troubles doing some experiments with
sqlalchemy (0.6.3) orm. Here are two code snippets to show the
problems I'm encountering.
## map_1.py
engine = create_engine("mysql://user:passw...@localhost/mydb")
metadata = MetaData(engine)
parent_table = Table('parent', metadata
Hi everyone,
I'm getting in trouble in th attempt to create a simple copy
(structure and data) of a table in my database (sql server). I need
the SQLAlchemy equivalent of the query:
SELECT * INTO newtable FROM table
How can I achieve this? I found that tometadata probably could do the
trick, but
Hi everyone,
I'm trying to write a small script to get all the table names from
SQLServer database (with pymssql). Up to now the script is really
simple:
engine = create_engine("mssql+pymssql://user:passw...@db_host/
db_name", encoding="cp1252")
metadata = MetaData(engine, reflect=True)
tabs = me
33 matches
Mail list logo