CSV Importer - How do I pull in comments?
Hi
I am soon to import ~ 100 bugs from Pivotal Tracker to YouTrack to use as our new bug tracking system, I have completed the mappings and have been able to get test data in, however I am I have not been able to figure out how best to import comments. So far I have inadvertently created new fields called comments! :-)
Can you advise the best method to import comments?
Format of the test file I am using is:
"summary","description","comments"
"1 This is a summary","This is a description","This a comment"
Thanks
Anthony
Please sign in to leave a comment.
Hello, Anthony!
Current format for comments is:
<field1>, <field_2>
<field1 value>, <field2 value>, <this column doesn't have name, so this will be the first comment>, <this will be the second comment>, <and this will be the third>
If you want to use some other format, you should modify script.
If you need any more help -- feel free to ask!
Thanks Anna, I could not find this documented anywhere - did I perhaps miss a support page? If not is this something that could be added to the help files please? As someone may encounter this in the future.
Thanks
Anthony
Yes, this is not mentioned in documentation -- I'll update it. Thank you!
I am having similar issues to the original poster. I have filed a bug report relating to the documentation. http://youtrack.jetbrains.com/issue/JT-16895
I tried adding comments using your syntax example above but get the error:
AttributeError: 'str' object has no attribute 'created'
my CSV:
Project,Summary,Reporter,Created,Updated,Description,Issue Id
newproject,summary of issue,Steve T,2012-09-04 09:41:22,2012-09-05 09:41:22,description of issue,1234,comment1,comment2,comment3
map:
import csvClient
csvClient.FIELD_NAMES = {
"Project" : "project_name",
"Summary" : "summary",
"Reporter" : "reporterName",
"Created" : "created",
"Updated" : "updated",
"Description" : "description",
"Issue Id" : "numberInProject"
}
csvClient.FIELD_TYPES = {
"Fix versions" : "version[*]",
"State" : "state[1]",
"Assignee" : "user[1]",
"Affected versions" : "version[*]",
"Fixed in build" : "build[1]",
"Priority" : "enum[1]",
"Subsystem" : "ownedField[1]",
"Browser" : "enum[1]",
"OS" : "enum[1]",
"Verified in build" : "build[1]",
"Verified by" : "user[1]",
"Affected builds" : "build[*]",
"Fixed in builds" : "build[*]",
"Reviewed by" : "user[1]",
"Story points" : "integer",
"Value" : "integer",
"Marketing value" : "integer"
}
csvClient.CSV_DELIMITER = ","
csvClient.GENERATE_ID_FOR_ISSUES = True
csvClient.DATE_FORMAT_STRING = "%Y-%m-%d %H:%M:%S"
Could you please provide full error stacktrace.
File ".\csv2youtrack.py", line 140, in <module>
main()
File ".\csv2youtrack.py", line 20, in main
csv2youtrack(source_file, target_url, target_login, target_password)
File ".\csv2youtrack.py", line 35, in csv2youtrack
importer.import_csv()
File ".\csv2youtrack.py", line 46, in import_csv
self.do_import(projects, new_projects_owner_login)
File "C:\youtrack-rest-python-library\python\youtrackImporter.py", line 28, in do_import
self._import_issues(project_id)
File "C:\youtrack-rest-python-library\python\youtrackImporter.py", line 76, in _import_issues
[self._to_yt_issue(issue, project_id) for issue in issues])
File "C:\youtrack-rest-python-library\python\youtrackImporter.py", line 142, in _to_yt_issue
result.comments = [self._to_yt_comment(comment) for comment in self._get_comments(issue)]
File ".\csv2youtrack.py", line 53, in _to_yt_comment
result.created = comment.created = str(int(time.time() * 1000))
AttributeError: 'str' object has no attribute 'created'
Please, download the latest version.
Failed to import issue [ newproject-1234 ].Reason : <item id="1234" imported="false"><error fieldName="comment.author">V
alue is unknown</error><error fieldName="comment.author">Value is unknown</error><error fieldName="comment.author">Value
is unknown</error></item>Request was : <issue>
<field name="updated">
<value>1346838082000</value>
</field>
<field name="created">
<value>1346751682000</value>
</field>
<field name="numberInProject">
<value>1234</value>
</field>
<field name="summary">
<value>summary of issue</value>
</field>
<field name="reporterName">
<value>Steve_T</value>
</field>
<field name="description">
<value>description of issue</value>
</field>
<comment text="comment1" authorLogin="guest" created="1350569918038" />
<comment text="comment2" authorLogin="guest" created="1350569918038" />
<comment text="comment3" authorLogin="guest" created="1350569918038" />
</issue>
I fixed that problem too. Please, download the latest version.
How can we add date to comment, any specific format?
Thanks
Jorge Costa
Unfortunately, it's not possible to set date for comments at the moment.