Skip to content

Unable to import CSV into hosted database that enforces primary key ID #37399

@applesauce49

Description

@applesauce49

Bug description

  1. create a mysql connection to a mySQL hosted mysql server that enforces sql_require_primary_key = ON
  2. Enable CSV importing on the mysql server connection.
  3. Go through the Upload a file to database form and select any database on the server.

Result:
ERROR: (MySQLdb.OperationalError) (3750, "Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting.")

here's the output of the table create command it's trying to do: [SQL: CREATE TABLE superset_storage.stripe_subscription_data ( "index" BIGINT,

You can see it's trying to add an index column, it's just not adding "PRIMARY KEY" to it.

Screenshots/recordings

No response

Superset version

6.0.0

Python version

3.9

Node version

16

Browser

Safari

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions