Code Monkey home page Code Monkey logo

Comments (4)

cli248 avatar cli248 commented on August 23, 2024

I searched online and found the reason. http://stackoverflow.com/questions/1827063/mysql-error-key-specification-without-a-key-length

It seems that MySQL doesn't accept Text as primary key. If we still want to use Text as the primary key, the solution is to use VARCHAR type and place a limit of length on it.

Should dataset add support of VARCHAR type for MySQL?

from dataset.

cli248 avatar cli248 commented on August 23, 2024

in #27, String was added as one of the primary_type in create_table function, then it was changed to Text.

I am wondering if we can change Text back to String and modify create_table function as following,

if primary_type == 'Integer':
    # col = Column(primary_id, Integer, primary_key=True, autoincrement=auto_flag)
elif primary_type == 'String':
    # col = Column(primary_id, String, primary_key=True)
elif primary_type matches 'String\(\d+\)':
    # col = Column(primary_id, String(length), primary_key=True)
else:
    raise DatasetException("The primary_type has to be either 'Integer' or 'String'.") 

Thus, we can fix this bug that cannot create table with Text type in MySQL.

from dataset.

pudo avatar pudo commented on August 23, 2024

Do you want to make a pull request to that effect? I don't think there would be any problem with it...

from dataset.

cli248 avatar cli248 commented on August 23, 2024

yeah, I think we can use regex to match Integer|String(\(\d+\))? pattern.

I will make a pull request.

from dataset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.