8000 sqlautocode generates foreign keys but not relation information · Issue #31 · unalloc/sqlautocode · GitHub
[go: up one dir, main page]

Skip to content
sqlautocode generates foreign keys but not relation information #31
Open
@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. With attached sql create a MySQL db
2. run sqlautocode -d mysql://localhost/dbname -o model.py

What is the expected output? What do you see instead?
Expected: generated relation definitions 
Instead got:
samples = Table(u'samples', metadata,
    Column(u'id', SMALLINT(), primary_key=True, nullable=False),
    Column(u'name', VARCHAR(length=45, convert_unicode=False, assert_unicode=None, unicode_error=None, _warn_on_bytestring=False), nullable=False),
    Column(u'experiment_id', SMALLINT(), ForeignKey('experiments.id'), nullable=False),
    Column(u'timepoint_id', SMALLINT(), ForeignKey('timepoints.id'), nullable=False),
)

samples2conditions = Table(u'samples2conditions', metadata,
    Column(u'condition_id', SMALLINT(), ForeignKey('conditions.id'), primary_key=True, nullable=False),
    Column(u'sample_id', SMALLINT(), ForeignKey('samples.id'), primary_key=True, nullable=False),
)

class Condition(DeclarativeBase):
    __tablename__ = 'conditions'

    #column definitions
    experiment_id = Column(u'experiment_id', SMALLINT(), ForeignKey('experiments.id'), nullable=False)
    id = Column(u'id', SMALLINT(), primary_key=True, nullable=False)
    name = Column(u'name', VARCHAR(length=45, convert_unicode=False, assert_unicode=None, unicode_error=None, _warn_on_bytestring=False), nullable=False)

    #relation definitions


class Experiment(DeclarativeBase):
    __tablename__ = 'experiments'

    #column definitions
    id = Column(u'id', SMALLINT(), primary_key=True, nullable=False)
    name = Column(u'name', VARCHAR(length=45, convert_unicode=False, assert_unicode=None, unicode_error=None, _warn_on_bytestring=False), nullable=False)

    #relation definitions


class Sample(DeclarativeBase):
    __table__ = samples


    #relation definitions


class Timepoint(DeclarativeBase):
    __tablename__ = 'timepoints'

    #column definitions
    experiment_id = Column(u'experiment_id', SMALLINT(), ForeignKey('experiments.id'), nullable=False)
    id = Column(u'id', SMALLINT(), primary_key=True, nullable=False)
    name = Column(u'name', VARCHAR(length=45, convert_unicode=False, assert_unicode=None, unicode_error=None, _warn_on_bytestring=False), nullable=False)

    #relation definitions





What version of the product are you using? On what operating system?
* MySQL 5.1.47
* archlinux
* sqlautocode 0.6b1 (with issue27 patch)
* sqlalchemy 0.6.5
* python 2.7



Anyone any clue why these don't show up?

Kenny

Original issue reported on code.google.com by kennybil...@gmail.com on 10 Jan 2011 at 3:56

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0