Code Monkey home page Code Monkey logo

Comments (4)

pudo avatar pudo commented on July 22, 2024

Sorry, this is really poorly documented. The reference to Text is to the SQLAlchemy object of that name, not the string literal. You can import it from sqlalchemy.types. I'll leave this open to improve the docs.

from dataset.

3onyc avatar 3onyc commented on July 22, 2024

Considering that in the code at https://github.com/pudo/dataset/blob/master/dataset/persistence/database.py#L124

  if primary_type is 'Integer':
    auto_flag = False
    if primary_id is 'id':
      auto_flag = True
      col = Column(primary_id, Integer, primary_key=True, autoincrement=auto_flag)
  elif primary_type is 'Text':
    col = Column(primary_id, Text, primary_key=True)
  else:
    raise DatasetException(
      "The primary_type has to be either 'Integer' or 'Text'.")

you're comparing to strings, changing is to == would make the code function as specified in the documentation. And the alternative (If you want to use sqlalchemy.types) would be

primary_type is sqlalchemy.types.Integer

from dataset.

pudo avatar pudo commented on July 22, 2024

I'm sorry - I hadn't seen these type checks and only glanced over your ticket. Thanks for your thorough description and thanks @3onyc for the PR. Got to love open source :)

from dataset.

arusahni avatar arusahni commented on July 22, 2024

Thanks guys, that did the trick. 👍

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.