Alright, here is the right way to go about it as per DNAnexus support:
import pyspark
import dxpy
import hail as hl
sc = pyspark.SparkContext()
spark = pyspark.sql.SparkSession(sc)
hl.init(sc=sc)
spark.sql("CREATE DATABASE test LOCATION 'dnax://'")
id = dxpy.find_one_data_object(name="test")["id"]
hail_matrixtable.write("dnax://" + id + "/matrix.mt")
mt = hl.read_matrix_table("dnax://database-XXX/matrix.mt")
Thank you again for the help.