[sqlalchemy] twopahse for pyodbc dialect

2016-09-29 Thread Andrea Cassioli
Hi, I am working with SQLAlchemy to insert data in a MSSQL database. Typically we need to make regular insert of say half million rows in few tables. Right now I am using Core flavour to make batch insertion via pyodbc and I have notice that in the DB trace I have an entry per row declare @p1

[sqlalchemy] Handling big Python objects

2014-12-03 Thread Andrea Gavana
. Andrea. -- 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

Re: [sqlalchemy] Handling big Python objects

2014-12-03 Thread Andrea Gavana
in the whole network drive; 3. As an aside, not zlib-ing the files saves about 5 seconds/simulation (over a 20 seconds save) but increases the database size by 4 times. I'll have to check if this is OK. Thank you again for your interest. Andrea. -- You received this message because you are subscribed

Re: [sqlalchemy] Handling big Python objects

2014-12-03 Thread Andrea Gavana
Hi, On Thursday, December 4, 2014 12:02:42 AM UTC+1, Ams Fwd wrote: On 12/3/14 2:23 PM, Andrea Gavana wrote: On Wednesday, December 3, 2014 10:42:27 PM UTC+1, Jonathan Vanasco wrote: On Wednesday, December 3, 2014 4:23:31 PM UTC-5, Ams Fwd wrote: I would

[sqlalchemy] Re: Using Sqlalchmy with pyodbc driver to access a MS SQL Server

2012-11-09 Thread Andrea Cappelli
Hi, I solved the problem putting [FreeTDS] Description = TDS driver (Sybase/MS SQL) Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so in /etc/odbcinst.ini and using the following uri mssql+pyodbc://user:pass@host:1433/dbname?driver=FreeTDS Hope this helps Andrea Il giorno venerdì 9

[sqlalchemy] Using Sqlalchmy with pyodbc driver to access a MS SQL Server

2012-11-08 Thread Andrea Cappelli
Hi, I'm trying to access a MS Sql Server from a python script using SQL Alchemy. If I use pymssql driver everything works well, except I receive a warning about Decimal field converted to float, with some possible data loss; so I tried to switch to pyodbc driver that shouldn't have this issue,

[sqlalchemy] writing on db performances

2012-08-23 Thread andrea crotti
I'm doing some experiments to see what is the best approach to write a lot of data on disk, On file and running commit after every opoeration: Function in_file took 64.531976 seconds to run In memory and not dumping to file: Function in_memory took 0.242011 seconds to run On file and

[sqlalchemy] Create tables from class declaration

2012-08-21 Thread andrea crotti
The question is probably very simple, but I can't find an answer anywhere... Suppose I already have some tables declarad in a declarative way, as below, how do I create the database schema from them? I usually always did with the meta.create_all() after defining the various Table('name', meta...)

Re: [sqlalchemy] Create tables from class declaration

2012-08-21 Thread andrea crotti
2012/8/21 Simon King si...@simonking.org.uk: The MetaData instance is available via the declarative base class, so you should be able to do something like: Base.metadata.create_all() http://docs.sqlalchemy.org/en/rel_0_7/orm/extensions/declarative.html#accessing-the-metadata Hope that

[sqlalchemy] Simplified database

2012-06-29 Thread andrea crotti
I am rewriting a big codebase that has to deal with an overly complicated database. So one thing which I found very useful for testing purposes is to replicate only the tables and columns that I actually need and load them in a memory database to play around with things. So for example I have

[sqlalchemy] Long expressions

2012-06-29 Thread andrea crotti
Supposing for example that I want to do a simple select * from table it becomes: table.select().execute().fetchall() which is a bit harder to understand, and things get more complicated (for me at least) with joins co. Is there a good explanation somewhere of the algorithm that actually

[sqlalchemy] Re: Attribute modified but object not in session.dirty

2012-03-12 Thread Andrea
Problem solved! Thanks a lot Michael, Andrea On 10 Mar, 03:23, Michael Bayer mike...@zzzcomputing.com wrote: this is in-place mutation so you need to send SQLAlchemy a signal that something has changed using the Mutable interface, which involves subclassing array.array.  See the docs

[sqlalchemy] Attribute modified but object not in session.dirty

2012-03-09 Thread Andrea
Hi all, at http://pastebin.com/jYsZwj10 an extract of my code. I create a custom type HexString that extends TypeDecorator. When I modify an object of this type on a persisted instance, changes don't affect session. I need some help, tnx. Andrea -- You received this message because you

Re: [sqlalchemy] Object inheritance

2012-02-24 Thread Andrea Della Pietra
out of topic. How can I map the attribute toPersistAttrComplex of last pastebin example? Tnx, Andrea On Feb 22, 2012, at 6:20 AM, Andrea wrote: Hi all, I have some object on a pre-existing model. Now we want to add a persistance layer and so SQLAlchemy/SQLite will be our choice. When I

[sqlalchemy] Object inheritance

2012-02-22 Thread Andrea
is _Struct inheritance that destroys mapper instrumentation? Any suggestion? Thanks, Andrea -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email

[sqlalchemy] Re: Object inheritance

2012-02-22 Thread Andrea
, Andrea andrea.dellapie...@gmail.com wrote: Little update: If I remove self.__dict__ = self from _Struct definition exception is not raised. This is the original base class: class _Struct(dict):     def __init__(self,**kw):         dict.__init__(self, kw)         self.__dict__ = self

[sqlalchemy] Deleting an object from a database?

2007-03-08 Thread Andrea Gavana
? Thank you in advance for your suggestions. Andrea. Imagination Is The Only Weapon In The War Against Reality. http://xoomer.virgilio.it/infinity77/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group

[sqlalchemy] Re: Deleting an object from a database?

2007-03-08 Thread Andrea Gavana
should be cleaned... I am surely missing something here. Thank you for your suggestions. Andrea. Hi All, at the end, I finally cracked the problem with the tree-structured database with SQLAlchemy. I still have however a problem. I am using a physical database, not an in-memory one

[sqlalchemy] Re: Deleting an object from a database?

2007-03-08 Thread Andrea Gavana
I am doing wrong? Thank you for your suggestions. Andrea. Imagination Is The Only Weapon In The War Against Reality. http://xoomer.virgilio.it/infinity77/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] Re: Deleting an object from a database?

2007-03-08 Thread Andrea Gavana
SQLAlchemy is the easiest Python-database-library to use, and for this reason I would like to avoid making stupid mistakes which would be much more complicated to fix later. Thank you for your answer. Andrea. Imagination Is The Only Weapon In The War Against Reality. http://xoomer.virgilio.it

[sqlalchemy] Re: Deleting an object from a database?

2007-03-08 Thread Andrea Gavana
didn't understand it was directly related to sqlite, I thought it was a general behavior of all databases, but obviously I was wrong. I have chose sqlite because it's already there in Python 2.5, but I'll try with other databases to see what happens. Thank you for your answer. Andrea. Imagination

[sqlalchemy] Re: Deleting an object from a database?

2007-03-08 Thread Andrea Gavana
(VACUUM) After having deleted the nodes. I don't know if this is the most correct way to proceed, but the command has shrunk back the database file size to 3 Kb, which was the original file size of the empty database. Thank you for your help. Andrea. Imagination Is The Only Weapon In The War Against

[sqlalchemy] Compressing cPickled objects == store in DB

2007-03-08 Thread Andrea Gavana
), and then change to newDataBase=False. Any thought? Andrea. Imagination Is The Only Weapon In The War Against Reality. http://xoomer.virgilio.it/infinity77/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] Re: Problems with select() :-(

2007-03-07 Thread Andrea Gavana
, not an in-memory, and I would like to be able to load the data after I saved them. I am sorry for my poor knowledge of SQLAlchemy, I just started. Thank you for your suggestions. Andrea. Imagination Is The Only Weapon In The War Against Reality. http://xoomer.virgilio.it/infinity77