Skip to content
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

FieldTable auto-creates the table, but SimpleTable doesn't #60

Open
longhotsummer opened this issue Oct 26, 2016 · 3 comments
Open

FieldTable auto-creates the table, but SimpleTable doesn't #60

longhotsummer opened this issue Oct 26, 2016 · 3 comments

Comments

@longhotsummer
Copy link
Collaborator

longhotsummer commented Oct 26, 2016

Declaring a FieldTable auto-creates the table in the database, but SimpleTable expects the table to exist and introspects it to get column data. They should behave the same way.

@cliftonmcintosh
Copy link
Contributor

cliftonmcintosh commented Oct 29, 2016

@longhotsummer

I would be happy to try my hand at addressing this issue. I am not familiar with how table creation through introspection works in Wazimap. Do you have any hints about where to start looking in the current code?

I suppose one concern is that SimpleTable does not take a fields parameter. Is the model parameter what is used for determining fields instead? And do you know of an example of someone using a model when declaring a SimpleTable?

@longhotsummer
Copy link
Collaborator Author

Which do you think is better to do? Should we use the FieldTable behaviour that does the database work for you but requires your to explicitly list fields in the tables.py file? Or should we use the SimpleTable behaviour where it introspects the database, which means you need to do the database work?

I tend to think that Wazimap managing the database is easier, but I'd like to know what that was like for a new user.

@cliftonmcintosh
Copy link
Contributor

cliftonmcintosh commented Nov 1, 2016

I would vote for something that allows the declaration in tables.py to create the database table. As a new user, I appreciated the simplicity of the FieldTable behavior -- having Wazimap manage the database. I think having the SimpleTable behave similarly is advantageous. Then there is only one workflow.

Can this behavior be achieved with declaring a model in a SimpleTable? Is that what the model parameter is for? If so, I think that is sufficient and including information about how to do that in the documentation would be all that is needed.

For what it's worth, the documentation says Wazimap will create the table.

Adding a Simple Table

First, you must register your Simple Table in your project’s tables.py. When Wazimap starts, it will create the underlying database table if it doesn’t already exist.

I didn't see any documentation that stated that a SimpleTable required that the table already exist in the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants