This looks like a bug in Elixir, which passes the user specified name
for the constraint *alongside* the constraint name that it generates
rather than instead of it.
i.e. (in relationships.py):
source_desc.add_constraint(ForeignKeyConstraint(
fk_colnames, fk_refcols,
name=fk_name,
**self.constraint_kwargs))
fk_name is an auto-generated name for the constraint and the
(constraint) name specified in the constraint_kwargs dict is passed as
well via **self.constraint_kwargs to the ForeignKeyConstraint
To avoid sending two names, you could precede this call with something
like:
try:
if self.constraint_kwargs['name']:
fk_name = self.constraint_kwargs['name']
del self.constraint_kwargs['name']
except KeyError:
pass
Having overcome this problem however, I am left with the generated
index names being too long - it is possible to get around this
problem?
e.g.
sqlalchemy.exceptions.DatabaseError: (DatabaseError) ORA-00972:
identifier is too long
'CREATE INDEX "ix_CommunicationAddressee_communication_id" ON
"CommunicationAddressee" (communication_id)' {}
Thanks for your thoughts,
Tim
On Apr 14, 4:55 pm, "Dr.T" <[EMAIL PROTECTED]> wrote:
> I have been developing using SQLite at the backend for development
> purposes and am now switching to Oracle.
>
> Unfortunately the foreign key constraint names generated by Elixir/
> SQLAlchemy exceed the 30 char limit on identifier name in Oracle. (I
> have already sorted the table & intermediate table names out with
> their relevant options)
>
> I read that "constraint_kwargs" is a dictionary which can be passed in
> the column definition and the source suggests that the constraint name
> should be specified as "name" within this dict.
>
> However when I specify the constraint_kwargs={"name":
> "UplFile_DocId_FK"} in the column declaration (example DSL pasted
> below) , I get an error on generating the schema:
>
> << TypeError: _FigureVisitName object got multiple values for
> keyword argument 'name' >>
>
> What is the correct means of specifying the name of a foreign key?
>
> ########################################################################
> class UploadedFile(Entity):
> """ A file uploaded representing the rendering of a document"""
>
> # fields
> --------------------------------------------------------------
> has_field('id', Integer, primary_key=True)
> has_field('filename', Unicode(100), nullable=False)
> has_field('abspath', Unicode(2000), nullable=False)
> has_field('size', Integer)
>
> # relationships
> ----------------------------------------------------
> belongs_to('document', of_kind='Document',
> constraint_kwargs={"name": "UplFile_DocId_FK"})
> using_options(tablename='UploadedFile')
>
> Thanks for any help,
>
> Tim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---