Skip to content

Commit

Permalink
Create bind_dataset_json.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cconrad8 authored Jan 31, 2025
1 parent 0fbb68b commit a3d6d59
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions example_script/bind_dataset_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import synapseclient
import time
import json

# Initialize Synapse client and login
def initialize_synapse():
syn = synapseclient.Synapse()
syn.login() # Add your username and password if needed
return syn

# Define the schema binding function
def bind_schema(syn, object_id, schema_id):
print(f"Binding schema '{schema_id}' to entity '{object_id}'...")
bind_request = {
"entityId": object_id,
"schema$id": schema_id
}
syn.restPUT(f"/entity/{object_id}/schema/binding", json.dumps(bind_request))
print("Schema successfully bound to the entity.")

# Main function to run the script
def main():
syn = initialize_synapse()


# # Create schema
# job_status = create_schema(syn, schema_request_body)

# Object IDs to bind schema to
object_ids = [
"syn52369033"
] # Replace with actual entity IDs

schema_id = "https://repo-prod.prod.sagebase.org/repo/v1/schema/type/registered/org.synapse.nf-superdataset"

# Bind each schema
for object_id in object_ids:
bind_schema(syn, object_id, schema_id)

if __name__ == "__main__":
main()

0 comments on commit a3d6d59

Please sign in to comment.