Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 03:59
    zzzeek milestoned #5984
  • 03:59
    zzzeek labeled #5984
  • 03:59
    zzzeek labeled #5984
  • 03:59
    zzzeek labeled #5984
  • 03:59
    zzzeek opened #5984
  • Feb 25 22:23
    sqlalchemy-bot closed #5967
  • Feb 25 22:23

    sqlalchemy-bot on master

    mutex asyncpg / aiomysql connec… (compare)

  • Feb 25 21:33
    zzzeek locked #5968
  • Feb 25 21:33
    zzzeek closed #5968
  • Feb 25 21:12
    zzzeek unlabeled #5981
  • Feb 25 21:12
    zzzeek milestoned #5981
  • Feb 25 21:12
    zzzeek labeled #5981
  • Feb 25 21:12
    zzzeek labeled #5981
  • Feb 25 21:12
    zzzeek labeled #5981
  • Feb 25 21:11
    zzzeek labeled #5981
  • Feb 25 21:11
    zzzeek opened #5981
  • Feb 25 18:04
    zzzeek labeled #804
  • Feb 25 18:04
    zzzeek unlabeled #804
  • Feb 25 17:03
    CaselIT locked #5976
  • Feb 25 17:03
    CaselIT closed #5976
Gord Thompson
@gordthompson
(Is it just me or does the Gitter web UI get weirder with each passing day?)
Jonathan Vanasco
@jvanasco

@zzzeek @CaselIT would it make sense to document what each supported database+version reflects Identity() back as?

I'm not thinking about this as much for use by automated detection, but just so we get an idea of what this behavior and variances are.

Federico Caselli
@CaselIT
I guess so. But the odd one is mostly mssql that always reflect identity now
Jonathan Vanasco
@jvanasco
Actually, it might be a good idea to create a unittest that checks this - to catch when any of the databases reflect this differently
Federico Caselli
@CaselIT
I think there is already
Jonathan Vanasco
@jvanasco
the core functionality of this is covered by existing tests, but i mean checking every attribute that is relected
i overtest.
Federico Caselli
@CaselIT
so identity is standard so it should be all or nothing*
*mssql is the odd one, since it does not support the standard :)
Jonathan Vanasco
@jvanasco
sorry if i complicated the odbc quesiton. i didn't mean to suggest there are no reasons, just that 99.9% of people will want to use the other two drivers.
Federico Caselli
@CaselIT
Will we skip the meeting today given the Thanksgiving?
Gord Thompson
@gordthompson
Not Thanksgiving here; ours was weeks ago.
Federico Caselli
@CaselIT
oh, canada also has one?
do you also have the 🦃?
Gord Thompson
@gordthompson
Yeah, second Monday in October. Our harvests are earlier up here.
Weird. Chrome can't render the emoji but Firefox can.
Federico Caselli
@CaselIT
oh strange.
Gord Thompson
@gordthompson
Yup, turkey is traditional here, too. Ham is also popular. I always vote for "both", especially if I'm not the one doing the cooking.
One thing we don't (typically) do is "sweet potato pie". Never had it, myself.
It's usually pumpkin pie for us.
mike bayer
@zzzeek
hey, sorry yes today was no meeting :) big long day here
Jonathan Vanasco
@jvanasco
Sweet Potato Pie is terrible. Pumpkin Pie is rarely made of actual pumpkins. "canned pumpkin" is from the Dickinson Squash which was renamed "Dickinson Pumpkin"; it's closer to a butternut squash. (happy to ruin thanksgiving for all!)
Federico Caselli
@CaselIT
I believe I've never tasted them. sweet potatos are not common here
Jonathan Vanasco
@jvanasco
They are very similar to Yams, if you have had those.
Federico Caselli
@CaselIT
can't say I'm familiar with those either
Federico Caselli
@CaselIT

@CaselIT with that kind of thing we look at the attributes and if an attribute is not set, we dont comapre it to the reflected one

I'm looking again at this. I'm not sure if it works in every case: sa you have modified some value and set it again to the default, this logic would not pick it up

@zzzeek other than the foolproof option to also compare with the default value from the connection I don't see another option at the moment. but that would mean creating a table, reflecting back the identity column and rolling back the creation
unless we hardcode the values (doable, but not a really great solution)
Jonathan Vanasco
@jvanasco
What if the default values are singletons with str and not strings themselves?
Federico Caselli
@CaselIT
this is for identity
Jonathan Vanasco
@jvanasco
__str__. Mike uses a pattern like that in dogpile with the novalue
Federico Caselli
@CaselIT
basically the problem is:
if I have a Column('foo', Integer, Identity()) this renders the default, but when reflecting I get back Identity(start=1, increment=1, minvalue=1, maxvalue=2147483647, cycle=False, cache=1)
for the metadata I can compare with the empty Identity to see what are the attribute that are changed.
but for the connection I need to know what's the default.
Jonathan Vanasco
@jvanasco
hm. sorry, i was trying to solve for differentiating if start=1 within Python is from the user or a default
Federico Caselli
@CaselIT
that one works by checking with an empty identity, but if I have the case:
  • user set Identity(increment=2)
  • creates the table
  • remove the increment (is sets Identity())
  • this one does not get reflected
Federico Caselli
@CaselIT

ok this works

    def _default_identity(self, autogen_context, col_type):
        if self._reflected_identity_default is not None:
            return self._reflected_identity_default
        nested = autogen_context.connection.begin_nested()
        try:
            name = "alembic_temp_table_%s" % id(self)
            meta = MetaData()
            Table(name, meta, Column("c", col_type, sqla_compat.Identity()))
            meta.create_all(autogen_context.connection)
            meta2 = MetaData()
            table2 = Table(name, meta2)
            sqla_compat._reflect_table(autogen_context.inspector, table2, None)
            self._reflected_identity_default = table2.c.c.identity
            self._reflected_identity_default.column = None
            return self._reflected_identity_default
        finally:
            nested.rollback()

but is very ugly
@zzzeek thoughts

mike bayer
@zzzeek
@CaselIT clearly im not following this identity thing nor much else lately
@CaselIT is that ...creating a table to try to detect something ?
i wouldnt do that...:)
nobody is going to appreciate that happening
Federico Caselli
@CaselIT
Indeed it is. I too would not do that. Comparing existing identity is becoming a can of worms. I think I'm going to scale back the ambition and just detect creation / removal of it for the moment. A more intelligent logic can follow at a second time
mike bayer
@zzzeek
@CaselIT +1
Federico Caselli
@CaselIT
will do
an alternative is to configure the defaults in the code somewhere, but it's a bit long, since in will depend by the type / direction of the identity
mike bayer
@zzzeek
I'm not really hearing anything about identity from the userbase yet besides the user that brought up this whole thing in the 1st place so I dont think we have to go too crazy right now :)
as always the gigantic raging fire in alembic is the enum thing :)
never seen such a small area get so many requests for improvement
Federico Caselli
@CaselIT
Ahah. Enum are a bit of a mess also in pg. Like you cannot remove elements from it
mike bayer
@zzzeek
yup
they suck