File tree Expand file tree Collapse file tree 3 files changed +41
-4
lines changed Expand file tree Collapse file tree 3 files changed +41
-4
lines changed Original file line number Diff line number Diff line change 1+ # ---
2+ # jupyter:
3+ # jupytext:
4+ # formats: py:percent
5+ # text_representation:
6+ # extension: .py
7+ # format_name: percent
8+ # format_version: '1.3'
9+ # jupytext_version: 1.16.4
10+ # kernelspec:
11+ # display_name: ssb-fagfunksjoner
12+ # language: python
13+ # name: ssb-fagfunksjoner
14+ # ---
15+
16+ # %%
17+ from fagfunksjoner import ProjectRoot
18+ import os
19+
20+ # %%
21+ print (os .getcwd ())
22+
23+ # %%
24+ proj_root = ProjectRoot ()
25+
26+ # %%
27+ print (proj_root .path )
28+
29+ # %%
Original file line number Diff line number Diff line change 2828# %%
2929testfile_paths = [
3030 "file_v1.parquet" ,
31+ "file_v1__DOC.json" ,
32+ "file_v12__DOC.json" ,
3133 "file_v2.parquet" ,
3234 "file_v11.parquet" ,
3335 "otherfile_v3.parquet" ,
4648
4749
4850# %%
49- files = fs .glob (f"{ base_path } /{ folder_name } /*.parquet " )
51+ files = fs .glob (f"{ base_path } /{ folder_name } /*" )
5052files # noqa: B018
5153
5254# %%
5355versions .get_latest_fileversions (files )
5456
57+ # %%
58+ versions .latest_version_path ("/buckets/produkt/versions_paths_fagfunksjoner/file_v12__DOC" )
59+
5560# %%
5661versions .next_version_path (
5762 "/buckets/produkt/versions_paths_fagfunksjoner/file_v1.parquet"
5863)
5964
6065# %%
6166versions .next_version_path (
62- "gs://ssb-dapla-felles-data-produkt-prod/versions_paths_fagfunksjoner/file_v1 .parquet"
67+ "gs://ssb-dapla-felles-data-produkt-prod/versions_paths_fagfunksjoner/otherfile_v1 .parquet"
6368)
6469
6570# %%
Original file line number Diff line number Diff line change 1- """This module works with filepaths, and is especially aimed at GCS and Dapla .
1+ """This module works with filepaths and the versioning convention at SSB .
22
3- But it works locally as well if standard for versionizing datafiles are implemented.
43The main purpose is fileversions according to Statistics Norway standards.
4+ The aim is to help versioning up and getting the latest version of paths in use on storage.
5+
6+ The module is not targeted at files that do not follow the naming convention of versions,
7+ for example the __DOC.json-files, will not work, because they do not end with "_v1" before the file extension.
58"""
69
710import glob
You can’t perform that action at this time.
0 commit comments