ideally the truncation should be occuring at the SQL compilation phase so you wouldnt have this problem. i recall that being very complex but i should take a look again to see if theres any major barriers to that.
but for now, sure, ive no problem with a module-level global. just be aware that if i fix this in a better way it might be removed in a later release. On Mar 16, 2007, at 4:05 PM, Jose Soares wrote: > > Hi Michael, > > I see that sql.py uses a limit of 30 characters to create the column > label when "use_labels" is set to True. > If name is greater than 30 char long, the label is trunked at position > 24 and is appended a random integer to it. > Since the name created in this way is less useful, I would like to > sugest you to customize the maxlength of column names. > (PostgreSQL accepts until 63 characters for names, with SQLite you may > use very, very long names....) > > > def _get_label(self): > if self.__label is None: > if self.table is not None and > self.table.named_with_column(): > self.__label = self.table.name + "_" + self.name > #if self.table.c.has_key(self.__label) or > len(self.__label) >= 30: > if self.table.c.has_key(self.__label) or > len(self.__label) >= MAX_LABEL_LENGTH: > self.__label = self.__label[0:24] + "_" + > hex(random.randint(0, 65535))[2:] > else: > self.__label = self.name > self.__label = "".join([x for x in self.__label if x in > legal_characters]) > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---