-
Notifications
You must be signed in to change notification settings - Fork 80
Start improving search #988
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
Closed
Closed
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8c37d53
break up search object and move stats to qiita_ware
squirrelo d1390c5
update sql connection handler
squirrelo ff58d42
add helper utilities
squirrelo 0c2d23a
revert change to sqlconnectionhandler
squirrelo 8ab20c7
add samples property to ProcessedData object
squirrelo 929d27b
flake8
squirrelo de8a466
revamp search object to use giant join table
squirrelo ff6731d
search prep templates and data_types
squirrelo ae6dd10
bit of rearrangement
squirrelo 586a18e
refine search more
squirrelo 0de4037
update search for changes
squirrelo 056d4d0
update qiita_ware search to reflect changes
squirrelo 56f8175
merge upstream/master
squirrelo 3d29605
remove unused imports
squirrelo 58cabfa
update search help page
squirrelo 4a1e37c
address comments
squirrelo 112f73e
add disallowed column checks for sample and prep templates
squirrelo db3d334
add data patch to remove offending cols
squirrelo f8d3fce
rename instead of drop
squirrelo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--March 18, 2015 | ||
--Placeholder for python to run | ||
-- we don't really need an SQL patch, but having nothing here breaks the build | ||
select 42; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# March 18, 2015 | ||
# This removes study_id and processed_data_id columns from prep and sample | ||
# template dynamic tables, if they exist | ||
from psycopg2 import Error as PostgresError | ||
from qiita_db.sql_connection import SQLConnectionHandler | ||
|
||
conn_handler = SQLConnectionHandler() | ||
|
||
# Get all sample and prep templates with offending columns | ||
sql = """SELECT DISTINCT table_name from information_schema.columns where | ||
table_schema = 'qiita' AND | ||
(table_name SIMILAR TO '%%sample[_][0-9,]%%' OR | ||
table_name SIMILAR TO '%%prep[_][0-9,]%%') AND | ||
(column_name = 'study_id' OR column_name = 'processed_data_id')""" | ||
|
||
tables = [c[0] for c in conn_handler.execute_fetchall(sql)] | ||
for t in tables: | ||
# we know it has at least one of the columns, so drop both, and ignore | ||
# error if dropping non-existant column | ||
try: | ||
conn_handler.execute("ALTER TABLE qiita.%s RENAME COLUMN study_id TO " | ||
"study_id_template" % t) | ||
except PostgresError: | ||
pass | ||
try: | ||
conn_handler.execute("ALTER TABLE qiita.%s RENAME COLUMN " | ||
"processed_data_id TO " | ||
"processed_data_id_template" % t) | ||
except PostgresError: | ||
pass |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not ok to drop the columns, as you don't know which data are those columns holding. Please re-name the column names.