Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eurostat-fetcher
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
There was a problem fetching the latest pipeline status.
Show more breadcrumbs
dbnomics-fetchers
eurostat-fetcher
Commits
ecccb582
Commit
ecccb582
authored
7 years ago
by
Christophe Benz
Browse files
Options
Downloads
Patches
Plain Diff
Rewrite observations rows using an iterator
parent
6086836f
No related branches found
No related tags found
No related merge requests found
Pipeline
#1276
failed with stage
in 1 minute and 24 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
eurostat_to_dbnomics.py
+9
-11
9 additions, 11 deletions
eurostat_to_dbnomics.py
with
9 additions
and
11 deletions
eurostat_to_dbnomics.py
+
9
−
11
View file @
ecccb582
...
...
@@ -28,7 +28,6 @@ import argparse
import
binascii
import
hashlib
import
io
import
itertools
import
logging
import
os
import
re
...
...
@@ -255,17 +254,16 @@ def iter_git_objects_in_sdmx_series_element(series_element, sdmx_file_path, dsd_
if
column_name
not
in
required_observations_tsv_column_names
:
other_column_names
.
add
(
column_name
)
observations_tsv_column_names
=
required_observations_tsv_column_names
+
list
(
sorted
(
other_column_names
))
observations_tsv_str
=
"
\n
"
.
join
([
"
\t
"
.
join
(
observations_tsv_column_names
),
]
+
[
"
\t
"
.
join
(
observation
.
get
(
column_name
,
""
)
for
column_name
in
observations_tsv_column_names
)
for
observation
in
observations_tsv
])
observations_tsv_blob
=
Blob
.
from_string
(
observations_tsv_str
.
encode
(
'
utf-8
'
))
def
iter_observations_rows
():
yield
"
\t
"
.
join
(
observations_tsv_column_names
)
for
observation
in
observations_tsv
:
yield
"
\t
"
.
join
(
observation
.
get
(
column_name
,
""
)
for
column_name
in
observations_tsv_column_names
)
observations_tsv_blob
=
Blob
.
from_string
(
"
\n
"
.
join
(
iter_observations_rows
()).
encode
(
'
utf-8
'
))
observations_tsv_blob_id
=
observations_tsv_blob
.
id
# Some TSV observations files are exactly the same, and Git packs don't tolerate duplicate objects.
if
observations_tsv_blob_id
not
in
yielded_git_object_ids
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment