Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
migration_scripts
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
serpucga
migration_scripts
Commits
e093713a
Commit
e093713a
authored
Jul 12, 2019
by
serpucga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix: was writing the metadata instead of the header at the beggining of each file
parent
3cab07f8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
4 deletions
+3
-4
utils.py
lib/utils.py
+2
-3
pymongoexport_csv.py
pymongoexport_csv.py
+1
-1
No files found.
lib/utils.py
View file @
e093713a
...
@@ -88,6 +88,7 @@ def increase_metadata_count(
...
@@ -88,6 +88,7 @@ def increase_metadata_count(
def
create_tweet_output_path
(
def
create_tweet_output_path
(
header
:
str
,
tweet
:
dict
,
tweet
:
dict
,
output_dir
:
str
)
\
output_dir
:
str
)
\
->
str
:
->
str
:
...
@@ -108,10 +109,8 @@ def create_tweet_output_path(
...
@@ -108,10 +109,8 @@ def create_tweet_output_path(
# If the CSV file didn't already exist, initialize it with a header
# If the CSV file didn't already exist, initialize it with a header
if
os
.
path
.
isfile
(
tweet_output_file
)
is
False
:
if
os
.
path
.
isfile
(
tweet_output_file
)
is
False
:
with
open
(
os
.
path
.
join
(
output_dir
,
".metadata.json"
))
as
f
:
header
=
f
.
readline
()
.
strip
()
with
open
(
tweet_output_file
,
"w"
)
as
fw
:
with
open
(
tweet_output_file
,
"w"
)
as
fw
:
fw
.
write
(
header
)
fw
.
write
(
header
.
strip
()
)
add_newfile_to_metadata
(
add_newfile_to_metadata
(
tweet_output_file
,
tweet_output_file
,
os
.
path
.
join
(
collection_path
,
".metadata.json"
))
os
.
path
.
join
(
collection_path
,
".metadata.json"
))
...
...
pymongoexport_csv.py
View file @
e093713a
...
@@ -46,7 +46,7 @@ if __name__ == "__main__":
...
@@ -46,7 +46,7 @@ if __name__ == "__main__":
for
tweet
in
tweets_page
:
for
tweet
in
tweets_page
:
# Get output path and contents for the new CSV file
# Get output path and contents for the new CSV file
csv_tweet_output_path
=
\
csv_tweet_output_path
=
\
utils
.
create_tweet_output_path
(
tweet
,
output_dir
)
utils
.
create_tweet_output_path
(
header
,
tweet
,
output_dir
)
csv_tweet_contents
=
\
csv_tweet_contents
=
\
"
\n
"
+
str
(
utils
.
convert_tweet_to_csv
(
header
,
tweet
))
"
\n
"
+
str
(
utils
.
convert_tweet_to_csv
(
header
,
tweet
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment