Hi All,
I have a model roughly like this:
class Instrument(Base):
__tablename__ = 'instrument'
id = Column(String(10), primary_key=True)
name = Column(String(100))
class Symbol(Base):
__tablename__ = 'symbol'
instrument_id = Column(String(10),
Hi All,
I seems to commonly need to do a query which should return zero or one
mapped objects.
.one() isn't what I want as no returned object is ok.
.first() isn't what I want as if my query would return more than one
object, I have the query wrong and so want an exception.
Is there
Hello.
This will probably be completely off-topic, but we have recently solved a
similar issue. In our case it was cherrypy's fault, because it uses 'implicit'
'sesssions.locking' by default. It acquires web session's lock at the beginning
of a web request processing and releases it at the end of
On Jun 17, 2013, at 08:58 , Chris Withers ch...@simplistix.co.uk wrote:
Hi All,
I seems to commonly need to do a query which should return zero or one mapped
objects.
.one() isn't what I want as no returned object is ok.
.first() isn't what I want as if my query would return more
Hello.
This is the current version of our windowed query:
from sqlalchemy.sql.expression import distinct
def windowed_query(query, column, options_or_callback, window_size=100):
Perform (a correct) yield_per() operation. See WindowedQuery.yield_per()
for more.
EXAMPLE:
q
I use sqlautocode to get declarative tables of the Firebird and now, when I
try to insert new row with unicode value for the field to the database I
got an error
ValueError: Value of parameter (30) is too long, expected 20, found 22'
which is Column('Myfield', VARCHAR(length=20)),
The db
hi!
curiosity [that may help me, lol]: is there a way to create a sqlite
database in memory, then save it to disk after initial inserts are done?
let's say I have around 2 gb of data to insert and ... it takes like
forever. i still have not convinced my boss to buy a ssd, so ... :D
cheers,
Hello.
Here is the fully self-contained regression of the issue, including the
workaround for SA 0.7.9. Thank you again, because I wouldn't figure it out
without your help (the select_from part). I haven't tried it on SA 0.9.
If you have any questions, please ask.
HTH,
Ladislav Lenart
On
I am trying to do a migration and am running into a problem where my
unique constraints are being delete with sqlite, but works fine with
postgres.
It seems that unique constraints are not present in the table, even before
the migration.
Ex.
engine = create_engine(sqlite:///my.db)
Session =
You can tell SQLite to disable syncing and journalling, it should get
very fast then:
if session.connection().dialect.name == 'sqlite':
session.connection().execute(PRAGMA synchronous=OFF)
session.connection().execute(PRAGMA journal_mode=OFF)
Of course, your data will be
Hello.
I ended up with the following query:
@classmethod
def _find_contacts_fetch_window(cls, contact_cls, win):
Special data-fetching query for contacts and all their related info
including tags, partner, client,...
NOTE: We build the FROM part entirely by hand,
I am having problem with a migration removing a unique constraint when
running a migration with sqlite. The migration works fine with postgres.
For some reason, when doing something like:
engine = create_engine(sqlite:///my.db)
Session = sessionmaker(bind=engine)
s = Session()
metadata =
I am trying to do a migration and am running into a problem where my
unique constraints are being delete with sqlite, but works fine with
postgres.
It seems that unique constraints are not present in the table, even before
the migration.
Ex.
engine = create_engine(sqlite:///my.db)
Session =
Hello.
I ended up with the following query:
@classmethod
def _find_contacts_fetch_window(cls, contact_cls, win):
Special data-fetching query for contacts and all their related info
including tags, partner, client,...
NOTE: We build the FROM part entirely by hand,
On Jun 17, 2013, at 2:36 AM, Chris Withers ch...@simplistix.co.uk wrote:
Hi All,
I have a model roughly like this:
class Instrument(Base):
__tablename__ = 'instrument'
id = Column(String(10), primary_key=True)
name = Column(String(100))
class Symbol(Base):
__tablename__
On Jun 17, 2013, at 5:33 AM, Wichert Akkerman wich...@wiggy.net wrote:
On Jun 17, 2013, at 08:58 , Chris Withers ch...@simplistix.co.uk wrote:
Hi All,
I seems to commonly need to do a query which should return zero or one
mapped objects.
.one() isn't what I want as no returned
On Jun 17, 2013, at 9:44 AM, graf a.zhabotins...@gmail.com wrote:
I use sqlautocode to get declarative tables of the Firebird and now, when I
try to insert new row with unicode value for the field to the database I got
an error
ValueError: Value of parameter (30) is too long, expected
Hmmm, never knew of that. All my constraints are already predefined
and inserts are in order so I won't get a broken FK. I'll try that too
see if it increases the speed (decreasing my headaches per build, lol).
Thanks a lot, Petr!
On 06/17/2013 11:18 AM, Petr Viktorin wrote:
You can tell
On Jun 15, 2013, at 4:32 PM, Rj Ewing ewing...@gmail.com wrote:
I am trying to do a migration and am running into a problem where my unique
constraints are being delete with sqlite, but works fine with postgres.
It seems that unique constraints are not present in the table, even before
Am 17.06.2013, 08:58 Uhr, schrieb Chris Withers ch...@simplistix.co.uk:
Hi All,
I seems to commonly need to do a query which should return zero or one
mapped objects.
.one() isn't what I want as no returned object is ok.
.first() isn't what I want as if my query would return more than
Simply handling NoResultFound should work just fine...
def zero_or_one(query):
try:
return query.one()
except NoResultFound:
return None
On Mon, Jun 17, 2013 at 6:36 PM, Michael Bayer mike...@zzzcomputing.com wrote:
On Jun 17, 2013, at 5:33 AM, Wichert Akkerman
Hi, I'm Witold and learn Sqlalchemy :)
I have a little problem, here it is:
This is my DB:
class Addressess(Base):
__tablename__ = 'addressess'
id = Column('id', Integer, Sequence('address_id_seq'),
primary_key=True, index=True, unique=True, nullable=False)
street =
Petr, just found something intesting that may work for anyone:
http://blog.marcus-brinkmann.de/2010/08/27/how-to-use-sqlites-backup-in-python/
I was able do create a database totally in memory and them just dump
it to a file. The process now takes about 5 minutes, against one hour+
that it
23 matches
Mail list logo