Skip to content

Commit 58b3d37

Browse files
author
Adam Robbins-Pianka
committed
Add CLI support for passing processed_date
1 parent 563dc68 commit 58b3d37

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

qiita_db/commands.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# The full license is in the file LICENSE, distributed with this software.
77
# -----------------------------------------------------------------------------
88

9+
from dateutil.parser import parse
910
import pandas as pd
1011
from functools import partial
1112
try:
@@ -128,8 +129,9 @@ def load_processed_data_cmd(fps, fp_types, processed_params_table_name,
128129
The ID of the row in the processed_params_ table
129130
preprocessed_data_id : int, optional
130131
Defaults to ``None``. The ID of the row in the preprocessed_data table.
131-
processed_date : datetime, optional
132+
processed_date : str, optional
132133
Defaults to ``None``. The date and time to use as the processing date.
134+
Must be interpretable as a datetime object
133135
134136
Returns
135137
-------
@@ -148,6 +150,9 @@ def load_processed_data_cmd(fps, fp_types, processed_params_table_name,
148150
else:
149151
preprocessed_data = None
150152

153+
if processed_date is not None:
154+
processed_date = parse(processed_date)
155+
151156
return ProcessedData.create(processed_params_table_name,
152157
processed_params_id, list(zip(fps, fp_types)),
153158
preprocessed_data, processed_date)

scripts/qiita_db

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# -----------------------------------------------------------------------------
1010

1111
import click
12-
from datetime import datetime
1312

1413
from qiita_db.util import (get_filetypes, get_filepath_types,
1514
get_processed_params_tables)
@@ -58,9 +57,10 @@ def load_raw_data(fp, fp_type, filetype, study):
5857
@click.option('--preprocessed_data_id', type=int, default=None, help='The '
5958
'ID of the row in the preprocessed_data table from which '
6059
'this processed data was created')
61-
@click.option('--processed_date', type=datetime, default=None,
62-
help='The date to use as the processed_date. If None, then '
63-
'the current date and time will be used.')
60+
@click.option('--processed_date', type=str, default=None,
61+
help='The date to use as the processed_date. Must be '
62+
'interpretable as a datetime. If None, then the current date '
63+
'and time will be used.')
6464
def load_processed_data(fp, fp_type, processed_params_table,
6565
processed_params_id, preprocessed_data_id,
6666
processed_date):

0 commit comments

Comments
 (0)