Hello,
I get some data from DB and have a sequence of Row objects, how it is
possible to modify data in those objects attrs?
Something like
result = await dbsession.execute(query)
services = result.all()
for i, service in enumerate(services):
services[i].title = f"some text here
Thank you, Mike!
воскресенье, 20 ноября 2022 г. в 16:31:09 UTC+2, Mike Bayer:
> the quickest way at the moment is to use select(X.__table__, y_col), or,
> if you use select(X), you can execute from session.connection().execute().
>
>
>
> On Sat, Nov 19, 2022, at 5:31 P
Hello
For example I have two models X and Y, I want to get all columns from X
model and only one or two cols from Y model in the same Row as
[(x_col1, x_col2, x_col3, y_col1), ...] but not [(X, y_col1)] as I get when
I perform
select(X, Y.col1).join(X.y)
I just don't want to write all X model
022, at 4:15 PM, sector119 wrote:
>
> Hello,
>
> I got exception when I try to insert numpy.int8 type data.
> sqlalchemy.exc.ProgrammingError: (psycopg.ProgrammingError) cannot adapt
> type 'int8' using placeholder '%s' (format: AUTO)
>
> I'm trying to adapt it with co
Hello,
I got exception when I try to insert numpy.int8 type data.
sqlalchemy.exc.ProgrammingError: (psycopg.ProgrammingError) cannot adapt
type 'int8' using placeholder '%s' (format: AUTO)
I'm trying to adapt it with code below, but it looks like a bit
comprehensive.
Maybe you can suggest
ship-loading-with-loader-options
>
>
>
> On Wed, Jul 21, 2021, at 4:25 PM, sector119 wrote:
>
> Hello, Mike
>
> When I want to use some relationship I just set selectinload option on it
> like
>
> s = select(Database).options(selectinload(Database.person))
>
> Here
s = select(
Database
).options(
selectinload(
Database.person
).options(
joinedload(Person.city)
)
)
среда, 21 июля 2021 г. в 23:25:05 UTC+3, sector119:
> Hello, Mike
>
> When I want to use some relationship I just set selectinload option on it
> like
>
> s
Hello, Mike
When I want to use some relationship I just set selectinload option on it
like
s = select(Database).options(selectinload(Database.person))
Here Database.person is relationship with Person model
But what to do if I want to access some relationship of Person model? For
example
Hello!
On a PostgreSQL database can't get NOWAIT with FOR UPDATE clause (
sqlalchemy 1.4.18
from sqlalchemy.future import select
from unity.models.unity import Internal
sql = select(
Internal.person_id_internal
).with_for_update(nowait=True)
str(sql)
Out[12]: 'SELECT
Hello
Is it possible to set default tablespace for all indexes?
I know that I cat set it with
Index('my_index', my_table.c.data, postgresql_tablespace='my_tablespace')
But I want to set set it by default somehow, that when I just put
"index=True" on column, I get index created at some
one ?
понедельник, 28 декабря 2020 г. в 19:53:24 UTC+2, Mike Bayer:
>
>
> On Mon, Dec 28, 2020, at 12:37 PM, sector119 wrote:
>
> Thank You, Mike,
>
> Do you mean that I have to remove all foreign() annotations from all my
> relationships like this?
> servi
the foreign() annotation from the Transaction.service column.
> the primary joins already have enough information based on the service_id,
> organization_id and person_id columns.
>
>
> On Mon, Dec 28, 2020, at 6:04 AM, sector119 wrote:
>
> I get following warning with my m
move the foreign() annotation from the Transaction.service column.
> the primary joins already have enough information based on the service_id,
> organization_id and person_id columns.
>
>
> On Mon, Dec 28, 2020, at 6:04 AM, sector119 wrote:
>
> I get following warning with my mo
I get following warning with my model:
SAWarning: relationship 'Transaction.organization' will copy column
organizations.schema to column transactions.schema, which conflicts with
relationship(s): 'Transaction.service' (copies services.schema to
transactions.schema). If this is not the
return get_locality_path_q(self.id)
вторник, 2 июля 2019 г., 0:03:20 UTC+3 пользователь Mike Bayer написал:
>
> I don't know what you mean. is there SQL you know you want or is that the
> part you want to figure out?
>
>
> On Mon, Jul 1, 2019, at 4:21 PM, sector119 wrote:
>
> Mike,
Mike, is it possible to load "@property" as subquery? Maybe as
ARRAY[path_item, path_item, ...]
воскресенье, 30 июня 2019 г., 20:26:42 UTC+3 пользователь Mike Bayer
написал:
>
>
>
> On Sun, Jun 30, 2019, at 5:37 AM, sector119 wrote:
>
> Nice, thanks a lot, Mi
(self.id)
воскресенье, 30 июня 2019 г., 1:11:21 UTC+3 пользователь Mike Bayer написал:
>
>
>
> On Sat, Jun 29, 2019, at 11:24 AM, sector119 wrote:
>
> Hello,
>
>
> I have Locality model with 'path' property to get path from 'root' of tree to
> current item, everything
Hello,
I have Locality model with 'path' property to get path from 'root' of tree to
current item, everything works ok, but
I can't get result as Locality instance list..
When I use
*'*object_session(self).query(Locality).from_statement(q).order_by(Locality.id)'
I get
> if you want individual migration sections for each schema, with or
> without "schema" written in, there's ways to do all that also but that
> doesn't seem necessary if you are sharing a single model with multiple
> identical schemas.
>
The problem is that some one might alter some tables
тверг, 30 августа 2018 г., 16:09:35 UTC+3 пользователь Mike Bayer написал:
>
> On Thu, Aug 30, 2018 at 7:11 AM, sector119 > wrote:
> > Mike, but in run_migrations_online() I use conn =
> > connection.execution_options(schema_translate_map={None: schema_name})
> >
:12 AM, sector119 > wrote:
> > Hello
> >
> > I have N schemas with the same set of tables, 1 system schema with
> users,
> > groups, ... tables and 6 schemas with streets, organizations,
> transactions,
> > ... tables.
> > On those schemas tables
rint("Migrating schema %s" % schema_name)
context.configure(
connection=conn,
target_metadata=target_metadata
)
with context.begin_transaction():
context.run_migrations()
среда, 29 августа 2018 г., 12:12:
Hello
I have N schemas with the same set of tables, 1 system schema with users,
groups, ... tables and 6 schemas with streets, organizations, transactions,
... tables.
On those schemas tables I don't set __table_args__ = ({'schema': SCHEMA},)
I just call dbsession.execute('SET search_path TO
Here is SQL that works as expected:
SELECT
m.*,
d.*
FROM (
SELECT
person_id,
service_id,
person_id_internal,
meters_readings, -- two-dimensional array
meters_readings [generate_subscripts(meters_readings, 1)] [1] AS meter_id,
meters_readings
oops, .filter(database.c.person_id == person_id) fixed the problem.
Thanks!
четверг, 4 января 2018 г., 23:08:35 UTC+2 пользователь sector119 написал:
>
> Hello,
>
> In this query I get extra (unexpected) "databases" table name in FROM
> claus
Hello,
In this query I get extra (unexpected) "databases" table name in FROM clause
q = dbsession.query(
meter_readings.c.reading,
database.c.service_id
). \
select_from(
database.outerjoin(meter_readings, true())
).filter(Database.person_id == person_id)
erce?
четверг, 4 января 2018 г., 17:48:56 UTC+2 пользователь Mike Bayer написал:
>
> On Thu, Jan 4, 2018 at 6:49 AM, sector119 <sect...@gmail.com >
> wrote:
> > Hello,
> >
> >
> > I try to rewrite "meters_readings[generate_subscrip
eral()
q = dbsession.query(
meter_readings,
database
). \
select_from(database). \
outerjoin(meter_readings, true()). \
filter(Database.person_id == person_id)
return q
File "/home/sector119/PycharmProjects/epsilon/epsilon
Going back to the subject ))
I get error (and no data updated) while using no_autoflush
/Users/sector119/PythonVirtualEnv/supplements/lib/python2.7/site-packages/sqlalchemy/orm/session.py:2122:
SAWarning: Attribute history events accumulated on 1 previously clean
instances within inner-flush
With that query I get:
InvalidRequestError: Could not find a FROM clause to join from. Tried
joining to , but got: Can't find any
foreign key relationships between 'category' and 'product'.
Product and category model has many to many relationship
--
You received this message because you are
product_t = Product.__table__
product_flavor_t = ProductFlavor.__table__
product_t_a = product_t.alias()
op.add_column(u'product', sa.Column('servings', sa.Integer(), nullable=True))
op.add_column(u'product', sa.Column('flavors_count', sa.Integer(),
nullable=True))
servings =
, 25 февраля 2016 г., 15:19:11 UTC+2 пользователь sector119 написал:
>
> Hello,
>
> Can some one help me with that query? I get AttributeError: servings
> I expect that sqlalchemy use update from select for that query or it's not
> possible and I must use select(...).as_scalar()
s = select([func.coalesce(func.avg(product_flavor_t.c.size), 0).label('f1'),
func.count(product_flavor_t.c.id).label('f2')]).\
select_from(product_t.outerjoin(product_flavor_t))
op.execute(product_t.update().values(servings=s.c.f1, flavors_count=s.c.f2))
I tried that, but it
.__table__.c.id)
connection.execute(
Product.__table__.update().where(Product.__table__.c.id ==
target.product_id).values(quantity=quantity))
четверг, 25 февраля 2016 г., 11:52:50 UTC+2 пользователь Simon King написал:
>
> On Wed, Feb 24, 2016 at 9:51 PM, sector119 <sect...@
Hello,
Can some one help me with that query? I get AttributeError: servings
I expect that sqlalchemy use update from select for that query or it's not
possible and I must use select(...).as_scalar() for every updated column?
s =
Hello!
I have two models, Product and ProductFlavor with one-to-many relationship
And I have a listener, which I want to update Product.quantity on
ProductFlavor.quantity change:
@event.listens_for(ProductFlavor.quantity, 'set')
def quantity_set(target, value, oldvalue, initiator):
if value
Ok, that approach isn't cool.. I get another one from flask_jsontools and
it does what I need!
json.dumps(q, cls=DynamicJSONEncoder)
Base = declarative_base(cls=JsonSerializableBase)
import decimal
from datetime import datetime, date
from json import JSONEncoder
from sqlalchemy import
recursion depth exceeded while calling a
Python object
What can I do with that? Help me please!
Traceback (most recent call last):
File s.py, line 10, in module
print repr(r.to_dict())
File /Users/sector119/PycharmProjects/epsilon/epsilon/models/serializer.py,
line 31, in to_dict
value
Hello,
How can we jsonify the tuples returned by Query ?
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 sqlalchemy+unsubscr...@googlegroups.com.
To post
Column(ENUM('copy', 'insert', 'update', name='import_action')) *works*
Column(ARRAY(ENUM('copy', 'insert', 'update', name='import_action')))
*doesn't create enum type *
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To unsubscribe from this group
Code below creates enum type, but server_default still doesn't work as I
expect ))
import_action = ENUM('copy', 'insert', 'update', name='import_action')
class Import(Base):
__tablename__ = 'import'
id = Column(Integer, primary_key=True)
name = Column(UnicodeText, nullable=False)
Hello,
Help me create table with enum type column, SA do not create enum type
before table :(
And server_default doesn't set value that I expect, actions
import_action[] DEFAULT ARRAY['copy'] NOT NULL it set array['copy'], not
import_action['copy'] as default...
Code and exception:
from
Thanks a lot for your help, Michael !
--
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
Hello!
I can't create table in just created schema without commit() after CreateSchema
statement, code and traceback posted below.
Is it Ok? Or I make something wrong?
PS. Can I call CreateSchema with .execute_if(callable_=should_create) ?
from sqlalchemy import create_engine
from
Michael, I want to set search_path to locality schema that depends on user
settings.
And I have some kind of admin utility where user can setup locality environment
(schema) with set of tables and I have the list of models those should be
created at some schema that admin-user would specify..
Hello.
I have Category model:
class Category(Base):
__tablename__ = 'categories'
id = Column(Integer, primary_key=True)
parent_id = Column(Integer, ForeignKey('categories.id'))
name = Column(Unicode(255), nullable=False)
description = Column(UnicodeText)
position =
I want to order_by(Category.parent.name, Category.name) is it possible?
--
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 to
Hello.
Can't get this to work, I want to get users who is online - users
where last_read column = now() - 30 minutes
With DBSession.query(User).filter(User.is_online) query
But get the following error:
File /home/eps/devel/tourclub/pbb/pbb/models/__init__.py, line 147, in
module
class
Now I get
File
/home/eps/devel/tourclub/sqlalchemy/lib/sqlalchemy/sql/visitors.py, line
59, in _compiler_dispatch
return getter(visitor)(self, **kw)
File
/home/eps/devel/tourclub/sqlalchemy/lib/sqlalchemy/sql/compiler.py, line
370, in visit_column
raise exc.CompileError(Cannot
Thanks a lot, Michael! Works like a charm!
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sqlalchemy/-/W6s3M_bzrRAJ.
To post to this group, send email to
Thanks a lot, Michael!
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sqlalchemy/-/Vc5LM46bOiUJ.
To post to this group, send email to sqlalchemy@googlegroups.com.
To
Hi.
I think that I'm doing somethig wrong, but I can't get delete-orphah
work... No DELETES on static_page_urls are performed...
2011-11-12 12:31:14 EET LOG: statement: BEGIN
2011-11-12 12:31:14 EET LOG: statement: DELETE FROM static_pages WHERE
static_pages.id = 1
2011-11-12 12:31:14 EET
# test_event.py
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, ForeignKey
from sqlalchemy import Integer, UnicodeText
from sqlalchemy import event
from sqlalchemy.orm import
Thanks, Michael, it was my mistake.
I use sqlalchemy with pyramid and comment =
ReportComment(content=form.content.data, user=self.request.user)
where self.request.user is
class RequestFactory(Request):
@reify
def user(self):
db = DBSession()
username =
report.id = 1
2011-11-09 13:30:24 EET LOG: statement: SELECT users.id AS users_id,
users.username AS users_username
FROM users
WHERE users.username = 'sector119'
2011-11-09 13:30:24 EET LOG: statement: SELECT comment.id AS comment_id,
comment.content AS comment_content
Hello.
Why comments_after_insert_listener return None for target.report - backref
for TripReport.comments?
class TripReportComment(Base):
__tablename__ = 'trip_report_comments'
id = Column(Integer, primary_key=True)
content = Column(UnicodeText, nullable=False)
report_id =
Hi.
Why SA produce last UPDATE if I set report_id value?
And why it produces those two SELECTs if I do not perform read access to
report and report.comments?
Should not it exec only one insert?
report = session.query(TripReport).get(id)
comment = TripReportComment(content=form.content.data,
a pattern
like this. Here it would likely mean varying between t1 and t2 before
s is created.
On Oct 12, 2011, at 8:32 AM, sector119 wrote:
Hello.
Is it possible to replace some table with defferent one?
I want to get the same query, with the same columns, having, order_by
Hello.
Is it possible to replace some table with defferent one?
I want to get the same query, with the same columns, having, order_by,
where clauses but with different table name.
s.replace_selectable(t1, t1_alias) - works
s.replace_selectable(t1, t2) - doesn't
Thanks.
--
You received this
Hello.
Why func.sum(some_table.c.bigintfield) returns Decimal ?
documents_table.c.sum has BigInteger type (postgresql table field has
bigint type)
the same issue I got with postgresql date_part func, when I extract
year or month I got Decimal result, not int
s =
Hello.
How to make a copy of object with all relations? But with new PK value
and save?
Thanks.
--
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
(caching_query.FromCache('default',
'by_username')).\
filter_by(username=username).one()
def print_groups(user):
for g in user.groups:
print g.name
### END HELPERS
### CREATE
metadata.create_all(engine)
### END CREATE
### POPULATE
u1 = User('sector119', u'A', u'B', u'C
% python2.6 sacache.py
1. sector119 groups:
G1
2. sector119 groups:
G1
1. sector120 groups:
G1
2. sector120 groups:
G1
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe
sacache.py
1. sector119 groups:
G1
2. sector119 groups:
G1
1. sector120 groups:
G2
2. sector120 groups:
G2
Now I would try to move from 6944 to 7195 (current) changeset by
changeset and see where it would be broken.
--
You received this message because you are subscribed to the Google Groups
Thank you, Michael!
On 22 Грд, 18:38, Michael Bayer mike...@zzzcomputing.com wrote:
Thank you, please apply the change in r9327b3748997 to your
_params_from_query() function.
On Dec 22, 2010, at 5:47 AM, sector119 wrote:
from beaker import cache
from sqlalchemy import *
from
`username` param and access `groups` relationship I got the same
groups as with first query and no sql being executed to get those
groups...
The same code works correctly with 0.6.5.
To reproduce:
% sudo invoke-rc.d memcached restart
[sudo] password for sector119:
Restarting memcached: memcached
fragments like this.
Though your print_groups() function here is wrong:
def print_groups(user):
for g in u.groups:
print g.name
On Dec 21, 2010, at 9:15 AM, sector119 wrote:
Hello!
I have a problem with my relationship caching with 0.7b1 (current
trunk)
When I perform
Hi All!
I have users_table mapped to User model.
###
mapper(
User,
users_table,
properties={
'locality': relation(Locality, uselist=False),
'office': relation(Office, uselist=False,
primaryjoin=users_table.c.office_id==offices_table.c.id,
cache_user_relationships = cache.RelationshipCache('default', 'by_id',
User.locality).and_(
cache.RelationshipCache('default', 'by_id',
User.office)).and_(
cache.RelationshipCache('default', 'by_id',
User.groups)).and_(
Is it have sense to have something like RelationFromCache(region,
namespace, attribute) ?
To use it like:
meta.Session.query(User).\
options(cache.RelationFromCache('default',
'by_id', User.office)).\
filter_by(username=username, disabled=False).\
I was wrong. This works, but it's not handy to recreate query manually
that was generated by by SA (it's lazy relation) :(
Maybe it's possible to do that another way?
q = meta.Session.query(Office).\
options(cache.FromCache('default',
'by_id')).\
And one more question about caching, how can I invalidate all cached
queries for User model?
For one user I make:
q = meta.Session.query(User).\
options(cache_user_relationships).\
options(cache.FromCache('default', 'by_username')).\
Hi All.
I have a problem with that query, how to rewrite it using sqlalchemy?
What to do with tuples - array_agg(row(meter_id,
organization_reading, reading)::meterreading) in psql I see it like
{(499680,137,141),(500765,258,267)} ?
And composite custom type - meterreading ?
How to create that
On Nov 4, 7:13 pm, Michael Bayer mike...@zzzcomputing.com wrote:
copy_from() probably creates some state that is not compatible with the
connection being used afterwards for subsequent operations, or
alternatively copy_from() is not compatible with some previous state.
The pool does
Hi All
ForeignKey and ForeignKeyConstraint copy() method make FK copy without
arguments, for example deferrable, ...
class ForeignKey:
def copy(self, schema=None):
Produce a copy of this ForeignKey object.
return ForeignKey(self._get_colspec(schema=schema))
class
--- schema.py 2009-11-04 13:27:37.124466356 +0200
+++ schema.py 2009-11-04 13:27:21.486350738 +0200
@@ -909,7 +909,17 @@
def copy(self, schema=None):
Produce a copy of this ForeignKey object.
-return ForeignKey(self._get_colspec(schema=schema))
+return
Oh, I forgot about that, it wasn't that behaviour that I realy
axpect..
I modify sql/compiller.py a bit to show what I mean. If I specify some
bindparam'eters at value(...) I want _only_ that columns to be at
update SET or insert VALUES..
--- compiler.py.orig2009-11-02 18:00:17.548954070
done.
--~--~-~--~~~---~--~~
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 to
I use sqlalchemy 0.6 and psycopg2 2.0.13.
When I try to copy from some little file it's ok, when from some
bigger one I got error and log posted below.
When I use pgbouncer and pass poolclass=pool.NullPool to create_engine
everything wor perfect with large file too.
My query is:
The latest trunk.
from sqlalchemy.dialects.postgresql import ARRAY
Traceback (most recent call last):
File console, line 1, in module
ImportError: cannot import name ARRAY
from sqlalchemy.dialects.postgresql.base import ARRAY
from sqlalchemy.dialects import postgresql
'ARRAY' in
Hi All.
I've got UnicodeDecodeError: 'ascii' codec can't decode byte 0xa1 in
position 3: ordinal not in range(128)
Why it can happen? I use client_encoding=utf8 at postgresql.conf and
encoding=utf-8 at create_engine.
File 'string', line 2 in submit
File '/home/sector119/devel/eps_env/lib
Thanks a lot, Michael!
On Oct 23, 4:09 am, Michael Bayer mike...@zzzcomputing.com wrote:
On Oct 22, 2009, at 3:26 PM, sector119 wrote:
Something strange, Michael.. All bindparams are different. Compliller
should not add to SET all params if values() has bindparam args, no?
where() have
Hi!
Is it possible to easily add tables to FROM clause, now I use
following code to append additional table names but it look like a
hack..
at PGCompiler.visit_update() I see self.stack.append({'from': set
([update_stmt.table])}) where and how it's used, may be using this I
can append some
Is there something wrong with ARRAY type in SA 0.6? no dialects/
dialect/__init__.py has ARRAY at __all__ !?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to
It's on trunk.
Elso can't import orm from sqlalchemy :/
On Oct 23, 6:00 pm, sector119 sector...@gmail.com wrote:
Is there something wrong with ARRAY type in SA 0.6? no dialects/
dialect/__init__.py has ARRAY at __all__ !?
--~--~-~--~~~---~--~~
You received
Hi All!
Why I get at SET part not only items from values(...), but all from
params passed to session.execute?
transactions_update =
model.transactions_table.update().where(and_(model.transactions_table.c.commit_date==bindparam('commit_date'),
though likely cleaner to pass the exact set of parameters desired.
How to pass that params if I use bindparam at where() and values(),
but I don't want to update colums that are at where() clause, only at
values() ?
--~--~-~--~~~---~--~~
You received this message
, Michael Bayer mike...@zzzcomputing.com wrote:
sector119 wrote:
though likely cleaner to pass the exact set of parameters desired.
How to pass that params if I use bindparam at where() and values(),
but I don't want to update colums that are at where() clause, only at
values() ?
if you
Hi all!
Why I get unbound method execute() must be called with Session
instance as first argument (got Select instance instead) with
following code?
from twisted.internet import reactor, task, threads
from twisted.application import service
from twisted.python import log
from sqlalchemy import
Hi All!
How to set default join condition if table has more than one FK to
another table?
It may be Transaction.user_id==User.id or
Transaction.rollback_user_id==User.id, I want first one to be default,
is it possible to do?
transactions_table = sa.Table('transactions', meta.metadata,
I create a small (4 lines) patch for databases/postgres.py
def _append_from(self, text, stmt):
return text.replace(' WHERE', ' FROM ' + string.join([table.name
for table in stmt.kwargs['postgres_from']], ', ') + ' WHERE')
def visit_update(self, update_stmt):
text = super(PGCompiler,
Hi all!
u = transactions_table.update().\
where(and_(transactions_table.c.commit_date==current_date, \
transactions_table.c.serial==serial, \
transactions_table.c.user_id==users_table.c.id, \
users_table.c.office_id==id)).\
Hi All!
I use postgresql and I have to emulate partial sequence (sequence with
predicate).
I have transactions table with serial_id field - this field have to
be autoincrement field and unique for commit_date and
user_office_id.
When I perform an insert to this table I have to do something
In SQL I hate that second SELECT, I can't perform SELECT MAX
(serial_id) FROM transactions WHERE bla,bla,bla FOR UPDATE;
because I get ERROR: SELECT FOR UPDATE/SHARE is not allowed with
aggregate functions...
--~--~-~--~~~---~--~~
You received this message
))
return Table(table.name, metadata,
schema=schema_map[table.schema], *args)
usage:
m2 = MetaData()
t2 = copy_table(t, m2, {None:'SOME_SCHEMA', 'system':'system'})
will map tables with no schema to SOME_SCHEMA, tables with system to
the system schema.
On Jan 20, 2009, at 3:02 PM, sector119
Hi ALL!
Does tometadata have to change foreign key schema name if it already
specified?
For example if I have column 'user_id' with 'system.users.id' FK -
tometadata change 'system' schema to SOME_SCHEMA. Is it ok, or
tometadata have to set schema to SOME_SCHEMA for street_id,
locality_id
Hi!
I use PostgreSQL and when I try to create schema I use following
command conn.execute('CREATE SCHEMA %(s)s', {'s':s})
I get raise exc.DBAPIError.instance(statement, parameters, e,
connection_invalidated=is_disconnect)
sqlalchemy.exc.ProgrammingError: (ProgrammingError) syntax error at or
Hi!
I have people_table:
people_table = sa.Table('people', meta.metadata,
sa.Column('id', sa.types.Integer, primary_key=True,
autoincrement=False),
sa.Column('street_id', sa.types.Integer,
sa.ForeignKey('streets.id'), nullable=False),
sa.Column('first_name', sa.types.Unicode(255),
98 matches
Mail list logo