dosubot[bot] commented on issue #30591:
URL: https://github.com/apache/superset/issues/30591#issuecomment-2409019742

   <!-- Greeting -->
   Hey there, @SuWenCheng! I'm here to help you with any bugs, questions, or 
contributions you have. Let's tackle this challenge together!
   
   <!-- Answer -->
   A similar issue was reported and closed in the Superset repository. The 
problem was caused by duplicate foreign key constraints in the migration 
script, leading to the ORA-02274 error. The suggested solution is to ensure 
that the foreign key constraint is defined only once in the migration script.
   
   Here's the corrected version of the script:
   
   ```python
   op.create_table(
       "metrics",
       sa.Column("id", sa.Integer(), nullable=False),
       sa.Column("metric_name", sa.String(length=512), nullable=True),
       sa.Column("verbose_name", sa.String(length=1024), nullable=True),
       sa.Column("metric_type", sa.String(length=32), nullable=True),
       sa.Column(
           "datasource_name",
           sa.String(length=255),
           nullable=True,
       ),
       sa.Column("json", sa.Text(), nullable=True),
       sa.Column("description", sa.Text(), nullable=True),
       sa.ForeignKeyConstraint(["datasource_name"], 
["datasources.datasource_name"]),
       sa.PrimaryKeyConstraint("id"),
   )
   ```
   
   This solution removes the redundant `sa.ForeignKey` definition and keeps 
only the `sa.ForeignKeyConstraint` 
<sup>[[1]](https://github.com/apache/superset/issues/19237)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to