Skip to content

Conversation

squirrelo
Copy link
Contributor

Fixes #50

antgonza and others added 30 commits September 27, 2013 08:19
added automatic python 2to3 conversion
added a mongodb+postgres prototype
Unify all the repositories
Makes code easier to read, updated some comments and docstrings,
makes all column names lowercase, changes varchar type to NOT have a
length limit
Also some other comments from @wasade
Add pronunciation hint to the README.md file.
Important documentation fix
Initial checkin of PostgreSQL prototype
@josenavas
Copy link
Contributor

This PR is ready to review (yay!!)

The additions included in this PR are:

  • The SQL layout have been modified to be able to successfully add a study to the database, including raw, preprocessed and processed data.
  • A SQL file has been added that populates the database with some test data.
  • A test has been added to check that the previous test data was able to be inserted in the database.
  • Since it is quite easy to break a production database when running the test code, a safeguard mechanism has been introduced. This mechanism consists on 2 points:
    (1) A config file has been added, parsed with the python ConfigParser, which includes a TEST_ENVIRONMENT variable.
    (2) A new settings table has been added to the database, which holds if the database is a test database or a production one.
  • This mechanism have been implemented through a decorator: qiita_test_checker. The decorator prevents the execution of the test if the database is a production db. Furthermore, this decorator (which should decorate the Test class) automatically decorates the setUp and tearDown functions to populate and clean up the test database, so each test is independent of each other and can assume the same exact data.
  • click has been added to the dependencies. A new command qiita_db make_test_env has been added. This command creates the qiita_test database in the postgres server. This way, we have complete control over the test database, since we are creating it.

Although there are 27 files modifies, a lot of them are the sql files and the placeholder files for the test_data folder (probably will hold data in the future or we'll make Travis download it through wget).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issue here, just want to say this is a bad ass way of setting this up.

@squirrelo
Copy link
Contributor Author

Also, you can safely ignore checking the qiita-db.html and qiita-db.dbs files. They are auto-generated saves from DbSchema.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this file change-of-name is just git weirdness?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup

@squirrelo squirrelo added this to the DB Interoperability milestone May 22, 2014
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAY!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cogent?
On May 22, 2014 8:16 AM, "teravest" notifications@github.com wrote:

In .travis.yml:

@@ -3,12 +3,9 @@ python:

  • "2.7"
    install:
    • pip install numpy
        • pip install cogent

YAY!


Reply to this email directly or view it on GitHubhttps://github.com//pull/52/files#r12955383
.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hahaha, yup, it was there... removing cogent speeded-up the travis runs 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding all these checks -- I think this should be plenty enough to make sure people don't accidentally blow away their database! They'd really have to intentionally screw up three things simultaneously (I think)

@josenavas
Copy link
Contributor

I think I've addressed all your comment. Let me know if I missed something!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these, it could be a nice use of functools.partial to do something like:

get_support_file = partial(join, join(dirname(abspath(__file__)), 'support_files'))

DFLT_BASE_DATA_FOLDER = get_support_file('test_data')
SETTINGS_FP = get_support_file('qiita-db-settings.sql')
LAYOUT_FP = get_support_file('qiita-db.sql')
INITIALIZE_FP = get_support_file('initialize.sql')
POPULATE_FP = get_support_file('populate_test_db.sql')

@adamrp
Copy link
Contributor

adamrp commented May 22, 2014

👍

antgonza added a commit that referenced this pull request May 22, 2014
initial database setup for travis
@antgonza antgonza merged commit f606d4a into qiita-spots:master May 22, 2014
@josenavas josenavas deleted the dbsql_travis branch May 22, 2014 22:22
@josenavas josenavas restored the dbsql_travis branch May 22, 2014 22:22
@josenavas
Copy link
Contributor

Thank you all for the comments! and thanks @squirrelo for the help to get this done!

@ElDeveloper ElDeveloper mentioned this pull request May 27, 2014
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

Successfully merging this pull request may close these issues.

Create test DB for travis

7 participants