Commit 7fff7f79 authored by harshit aggarwal's avatar harshit aggarwal
Browse files

Adding deployment script for azure to upload wks mappings to azure blob store

parent 0c5c7652
Pipeline #6128 failed with stage
in 1 minute and 36 seconds
{
"wksSchemaKind": "opendes:wks:wellbore:1.0.0",
"attributeMappings": [
{
"rawAttributeName": "acl",
"wksAttributeName": "acl"
},
{
"rawAttributeName": "ancestry",
"wksAttributeName": "ancestry"
},
{
"rawAttributeName": "id",
"wksAttributeName": "id"
},
{
"rawAttributeName": "kind",
"wksAttributeName": "kind"
},
{
"rawAttributeName": "legal",
"wksAttributeName": "legal"
},
{
"rawAttributeName": "meta",
"wksAttributeName": "meta"
},
{
"rawAttributeName": "version",
"wksAttributeName": "version"
},
{
"rawAttributeName": "data.Spud date",
"wksAttributeName": "data.spudDate"
},
{
"rawAttributeName": "data.UWI",
"wksAttributeName": "data.uwi"
},
{
"rawAttributeName": "data.dlLatLongWGS84.latitude",
"wksAttributeName": "data.dlWGS84.latitude"
},
{
"rawAttributeName": "data.dlLatLongWGS84.longitude",
"wksAttributeName": "data.dlWGS84.longitude"
}
]
}
import os
from os import listdir
from os.path import isfile, join
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
connect_str = os.environ.get('AZURE_STORAGE_CONNECTION_STRING')
container_name = os.environ.get('STORAGE_CONTAINER')
blob_service_client = BlobServiceClient.from_connection_string(connect_str)
local_folder = os.path.join(os.path.dirname(__file__), "mappings")
def upload_files():
files = [f for f in listdir(local_folder) if isfile(join(local_folder, f))]
for file in files:
local_file = join(local_folder, file)
blob_client = blob_service_client.get_blob_client(container=container_name, blob=file)
with open(local_file, "rb") as data:
blob_client.upload_blob(data, blob_type="BlockBlob")
if __name__=="__main__":
upload_files()
\ No newline at end of file
os
azure.storage.blob
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment