Skip to main content
Syntasa Notebook Utilities

Infra Utilities

synutils is the unified entry point in every notebook — a Python attribute and a Scala REPL alias. Each section below lists user-callable methods with examples in both languages.

infrastructure — platform infra metadata​

The full method surface, side by side. Use the canonical method in new code. Legacy aliases exist only for backward compatibility with pre-integration notebooks.

Properties (read-only attributes)​

ReturnsPythonScalaLegacy (Python)
Cloud provider —"AWS"/"GOOGLE"/"AZURE"providerTypeproviderTypeget_provider_type_from_metadata()
Cloud regionregionregion—
GCP project ID (empty for AWS/Azure)projectIdprojectId—
Default storage bucketbucketbucket—
Filesystem prefix (s3://,gs://,abfs://)fileSystemPrefixfileSystemPrefix—
Full storage path (prefix + bucket)storagePathstoragePath—
SSH connection typesshTypesshType—
Metastore type (AWS_GLUE/HIVE/BIGQUERY)metastoreTypemetastoreType—
Metastore hostnamemetastoreHostnamemetastoreHostname—

Section getters​

ReturnsPythonScalaLegacy (Python)
configsection — region, projectId, etc.getConfig()getConfig()get_config_from_metadata()
storagesection — bucket, pathsgetStorage()getStorage()get_storage_from_metadata()
networksectiongetNetwork()getNetwork()get_network_from_metadata()
metastoresectiongetMetastore()getMetastore()get_metastore_from_metadata()
securitysection — cloud creds, SSHgetSecurity()getSecurity()get_security_from_metadata()
Full payload (all sections)getAll()getAll()get_all_from_metadata(), asDict(), get_infrasturcture_json(token=None)
Global init script (Optional[str]/Option[String])getGlobalInitScript()getGlobalInitScript()get_global_init_script_from_metadata()
Drop the cached payloadclearCache()clearCache()—

Generic accessors (backward-compat with legacy InfrastructureClient)​

ReturnsPythonScalaLegacy (Python)
Any infraProvider section by nameget(resource)(usegetAll()("infraProvider")(resource))get(token, resource)
Same — aliasget_from_metadata(resource)—get_from_metadata(resource)
Full payload (legacy typo preserved)get_infrasturcture_json(token=None)—get_infrasturcture_json(token)

The token parameter is accepted on the legacy aliases but ignored — auth is handled by the underlying ApiClient at construction. Sensitive values under security / metastore come back as SecretString (redact on print, work as plain str with SDKs).

# Generic — fetch any section dynamically
synutils.infrastructure.get("storage") # plain dict
synutils.infrastructure.get("notebookConfig") # {"script": "..."}
synutils.infrastructure.get("security") # values redact when printed
# Legacy aliases
synutils.infrastructure.get_from_metadata("storage")
synutils.infrastructure.get_infrasturcture_json() # full nested payload

Python returns dict everywhere; Scala returns Map[String, AnyRef]. Same shape, language-native types.

Secret fields (encrypted + sealed)​

Encrypted fields are auto-decrypted by the platform and wrapped in SecretString so they redact in print / log output. Pull a value out of the dict and call .get() / .unseal() to reveal the decrypted plaintext.

SectionSecret field names
metastoremetastorePassword
securitykeyFile, accessKey, secretKey, sshUserPass
bigQuerykeyFile
bigTablekeyFile
redshiftpassword
kafkasslCertificate, sslKey
gitConfigpersonalAccessToken, oauthToken, sshKey

If decryption fails (no key, malformed ciphertext) the original ciphertext is preserved and a warning is logged — print(meta["metastorePassword"]) still redacts to **********, but .get() returns the raw ciphertext rather than the plaintext.

The seven subsections above are not exposed as individual section getters; access them via getAll() / asDict() / get_infrasturcture_json() or via the existing getMetastore() / getSecurity() for those two.

Python​

print(synutils.infrastructure.providerType, synutils.infrastructure.bucket) 
print(synutils.infrastructure.getStorage()) # full storage dict

sec = synutils.infrastructure.getSecurity()
print(sec) # {'accessKey': '**********', 'secretKey': '**********', ...}
sec["secretKey"].get() # decrypted plaintext

meta = synutils.infrastructure.getMetastore()
meta["metastorePassword"].get() # decrypted plaintext

payload = synutils.infrastructure.getAll()
payload["infraProvider"]["security"]["secretKey"].get() # decrypted
payload["infraProvider"]["metastore"]["metastorePassword"].get() # decrypted
payload["infraProvider"]["bigQuery"]["keyFile"].get() # decrypted JSON
payload["infraProvider"]["redshift"]["password"].get() # decrypted
payload["infraProvider"]["kafka"]["sslKey"].get() # decrypted
payload["infraProvider"]["gitConfig"]["personalAccessToken"].get() # decrypted

Scala​

SecretString is available as a bare name in notebook Scala sessions.

println(s"${synutils.infrastructure.providerType} ${synutils.infrastructure.bucket}") 
println(synutils.infrastructure.getStorage()) // full storage Map

val sec = synutils.infrastructure.getSecurity()
println(sec) // values render as **********

// Map[String, AnyRef] preserves the seal — values aren't auto-unsealed.
// Cast to SecretString to access .get() / .unseal().
val secretKey = sec("secretKey").asInstanceOf[SecretString]
println(secretKey) // **********
println(secretKey.get()) // decrypted plaintext

val pwd = synutils.infrastructure.getMetastore()("metastorePassword")
.asInstanceOf[SecretString]
val raw: String = pwd // implicit conversion reveals (decrypted)