Sanoid with script and systemd environment path

Hello,

I have setup sanoid package to create snapshot of mysql database. It specifies a python script to connect to the database. Unfortunately the script is not able to access the file on the filesystem. How can i allow the /root/ path to be accessible by the script?

This is how script is defined in configuration.

services.sanoid = {
  enable = true;
  
 templates.production = {
    hourly = 2; 
    daily = 30; 
    monthly = 3;
    autoprune = true;
    autosnap = true;
  };
 
  templates.mysql = {
    ### run script before snapshot
    pre_snapshot_script = "/usr/local/bin/mysql_lock_snapshot.py";
    ### run script after snapshot
    post_snapshot_script = "/usr/local/bin/mysql_unlock_snapshot.py";
    ### don't take an inconsistent snapshot (skip if pre script fails)
    no_inconsistent_snapshot = "yes";
    ### run post_snapshot_script when pre_snapshot_script is failing
    force_post_snapshot_script = "yes";
   ### limit allowed execution time of scripts before continuing (<= 0: infinite)
   script_timeout = 5;
  };
  datasets."ssdpool3/mysql" = {
    useTemplate = [ "production" "mysql" ];
    recursive = true;
  };
};

The /usr/local/bin/mysql_lock_snapshot.py script is supposed to read the database credentials from /root/.my.cnf but it is not able to do so.

$ cat /usr/local/bin/mysql_lock_snapshot.py
#!/usr/bin/env python
import MySQLdb

def mysqlconnect():
    try:
      db = MySQLdb.connect("192.168.1.2", read_default_file="/root/.my.cnf")  
    except:
            print("Can't connect to database")
            return 0
    print("Connected")
    cur = db.cursor()
    cur.execute("FLUSH TABLES WITH READ LOCK")
    db.close()

mysqlconnect()

How can i allow the script to access /root/.my.cnf. I tried to set services.sanoid.path=[ "/root"] but that did not help.