New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pwiz columns invalid names #1022

Closed
vinczente opened this Issue Jul 21, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@vinczente

vinczente commented Jul 21, 2016

in mysql fields can be named:
"source id"
"marketing/position"
in this case pwiz creates python model attributes of the same name.
Related issue: #184

@coleifer

This comment has been minimized.

Show comment
Hide comment
@coleifer

coleifer Jul 21, 2016

Owner

Hmmm....

Owner

coleifer commented Jul 21, 2016

Hmmm....

@coleifer

This comment has been minimized.

Show comment
Hide comment
@coleifer

coleifer Jul 21, 2016

Owner

Can you explain this in a bit more detail? What exactly is the nature of this bug?

Owner

coleifer commented Jul 21, 2016

Can you explain this in a bit more detail? What exactly is the nature of this bug?

@vinczente

This comment has been minimized.

Show comment
Hide comment
@vinczente

vinczente Jul 22, 2016

This is a example of generated code from pwiz

class Flag(BaseModel):
description = TextField(null=True)
flag id = CharField(null=True)
name = CharField(null=True)

python will syntax error:

flag id = CharField(null=True)
      ^

SyntaxError: invalid syntax

vinczente commented Jul 22, 2016

This is a example of generated code from pwiz

class Flag(BaseModel):
description = TextField(null=True)
flag id = CharField(null=True)
name = CharField(null=True)

python will syntax error:

flag id = CharField(null=True)
      ^

SyntaxError: invalid syntax

@vinczente

This comment has been minimized.

Show comment
Hide comment
@vinczente

vinczente Jul 22, 2016

Solution could be to escape the fields name and use a db_column property

flag_id = CharField(db_column='flag id', null=True)

vinczente commented Jul 22, 2016

Solution could be to escape the fields name and use a db_column property

flag_id = CharField(db_column='flag id', null=True)

@coleifer coleifer closed this in f565972 Jul 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment