Is there a stock function to test if an object attribute is a relationship?
I have created below function to test it, is there a better solution?
def is_relationship(obj, attr):
try:
p = inspect(getattr(type(obj), attr)).property
except (AttributeError, NoInspectionAvailable):
Thank you very much Mike!
The older baseline is on v0.9.7 but I am not sure if I can bump it up
'blindly' ... I think all constructs are "vanilla" so maybe it's safe.
In my v0.9.7 based model, I used history_meta recipe (slightly modified
though).
At any rate, after fudging around with some
On Thu, Sep 6, 2018 at 1:14 PM, HP3 wrote:
> Hello,
>
> As I try alembic (for the first time), I ran into the following stack traces
> when attempting to conduct a "nasty" migration.
>
> I call it "nasty" because the original model was based on sqlalchemy v0.9 +
> python 2.7 and the new model is
for ALTER, which is not what you illustrated earlier, server default
comparison is turned off by default as it can be unreliable in some
cases. Turn it on using compare_server_default=True:
Hello,
As I try alembic (for the first time), I ran into the following stack
traces when attempting to conduct a "nasty" migration.
I call it "nasty" because the original model was based on sqlalchemy v0.9 +
python 2.7 and the new model is sqlalchemy v1.2 + python 3.6.
ON TOP OF THAT, it's a
like this:
old model:
class TestModel:
ip = db.Column(db.INET, nullable=False)
new Model:
class TestModel:
ip = db.Column(db.VARCHAR(), nullable=False, server_default='127.0.0.1')
got migration:
op.alter_column('test', 'ip',
existing_type=postgresql.INET(),
Ok, that works almost fine:
>>> func.jsonb_agg(literal_column(models.OrderUINTable.name + '.*'))
'jsonb_agg(OrderUIN.*)'
The problem is OrderUIN. It must be quoted: jsonb_agg("OrderUIN".*)
чт, 6 сент. 2018 г. в 17:44, Антонио Антуан :
> Another one fail:
>
Another one fail:
func.jsonb_agg(*models.OrderUINTable.c.values()) - PG error: "function
jsonb_agg(integer, text, numeric, text, text, text, text) does not exist"
четверг, 6 сентября 2018 г., 17:28:37 UTC+3 пользователь Антонио Антуан
написал:
>
> Hi guys.
> I'm using sqlalchemy 1.1.13, want
Hi guys.
I'm using sqlalchemy 1.1.13, want to construct that query:
select o.*, jsonb_agg(ou.*) from "Orders" o left join "OrderUIN" ou on
ou."OrderID" = o."OrderID" group by o."OrderID"
I tried that options:
- func.jsonb_agg(OrderUINTable), got select o.*, jsonb_agg() from
"Orders"... Empty
OK the use case for the init_scalar, and the docs/example do a bad job
of explaining this, is to sync up the default value with that of a
Core-level default generator.That's not clear so I should improve
those docs.
On Thu, Sep 6, 2018 at 10:10 AM, Mike Bayer wrote:
> On Thu, Sep 6, 2018 at
On Thu, Sep 6, 2018 at 4:21 AM, Tomáš Sandrini wrote:
> Hi,
>
> I am writing a library where I need to hide (for normal usage, since that
> will be 90% use case) the existence of a Parent object,
> basically limiting it just to one property and then set the Parent manually
> within the Child
On Thu, Sep 6, 2018 at 3:50 AM, Yingchen Zhang wrote:
> so, alembic not support `default` ( pgsql create columnn ) ?
it does. use server_default."default" in SQLAlchemy refers to a
Python-side default.
>
> 在 2018年9月6日星期四 UTC+8上午12:24:54,Mike Bayer写道:
>>
>> On Wed, Sep 5, 2018 at 11:51 AM,
Hi,
I am writing a library where I need to hide (for normal usage, since that
will be 90% use case) the existence of a Parent object,
basically limiting it just to one property and then set the Parent manually
within the Child class through this one property.
An obvious solution to this would
so, alembic not support `default` ( pgsql create columnn ) ?
在 2018年9月6日星期四 UTC+8上午12:24:54,Mike Bayer写道:
>
> On Wed, Sep 5, 2018 at 11:51 AM, Yingchen Zhang > wrote:
> > db.Column('text_column', db.VARCHAR(20), default='test_text',
> > server_default='test_text', nullable=True)
> >
> > but,
14 matches
Mail list logo