Re: [sqlalchemy] Postgres how to autoincrement sequence number for new records, partitioned by column?

2016-09-06 Thread Duke Dougal
I'm sorry sqlalchemy hasn't fully clicked for me yet. I'm still stuck on this. A I meant to be translating the sql that Michael has suggested into an ORM query? This is as far as I have got which results in : NameError: name 'Issues' is not defined Even then I still don't see how to get the

[sqlalchemy] Postgres how to autoincrement sequence number for new records, partitioned by column?

2016-08-28 Thread Duke Dougal
I'm using POstgres 9.5, Python 3 and SqlAlchemy 1.0.14 When a new Issue is created, I want it to have sequence_number equal to the largest existing sequence number + 1 Each thread_id has its own sequence starting at 1. However when I create a new record I get: sqlalchemy.exc.ProgrammingError:

[sqlalchemy] Trying to create string array columns with Alembic gives "NameError: name 'String' is not defined"

2016-04-26 Thread Duke Dougal
Hi folks, Model is below plus error message below that. I am trying to create some array columns using Alembic but getting errors. Any help valued. thanks! from sqlalchemy import Column, String, Integer, DateTime from serve_spec.db_global import db import datetime from time import

[sqlalchemy] create_engine() creates sqlite database - how to disable / prevent this?

2015-04-04 Thread Duke Dougal
Is there a way to have create_engine NOT create a sqlite database in the event that one does not exist? thanks -- 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

Re: [sqlalchemy] create_engine() creates sqlite database - how to disable / prevent this?

2015-04-04 Thread Duke Dougal
OK I'll try again, apologies for not being clear. I want to connect to a Sqlite database if it exists, but if it does not exist, I want to execute my custom database creation code., which looks like this: def setupArchiveTables(db): import sqlite3 conn =

[sqlalchemy] Thread safety - is it safe to use the core in a web application?

2015-03-31 Thread Duke Dougal
I am using the Falcon web server and SqlAlchemy core. I have read warnings about it not being thread safe. I'm not sure what the implications are of this. Will there be a problem or can I code around it somehow? I'm trying to avoid the ORM for now - at least until I have some grasp of what

[sqlalchemy] SQLAlchemy core what's the right find if row with primary key exists

2015-03-31 Thread Duke Dougal
I'm trying to find if a row with a given primary key exists. Is this the right way to do it? I'm using Python 3.4 and Sqlite 3.8.2 from sqlalchemy.ext.automap import automap_base from sqlalchemy import create_engine, exists from sqlalchemy.schema import Table from sqlalchemy.schema import