PermissionError: [WinError 5] Access is denied When Running sqllineage Command in Node.js

I’m encountering a PermissionError while attempting to use the sqllineage command from within my Node.js application in deployment server in windows 10. Below is the code I’m using.

function analyzeLineage(callback) {
    // Execute sqllineage command with the SQL query directly
    const demoQuery = `CREATE OR REPLACE TABLE user_orders AS SELECT u.user_id, u.user_name, u.email, o.order_id, o.order_date FROM users u JOIN orders o ON u.user_id = o.user_id;`
    exec(`sqllineage -e "${demoQuery}"`, (error, stdout, stderr) => {
        if (error) {
            console.error(`Error: ${stderr}`);
            callback(error, null);
            logger.log({
                level: "error",
                message: `sqllineage -e analyze lineage : ${error}`,
            });
            return;
        }
        callback(null, stdout);
    });
}

I’m using sqllineage version 1.5.3. when I tried to execute this command through terminal, It works perfectly at the same location where my project is located but not working from code side.

Here’s the full error message I’m receiving:

{“level”:”error”,”message”:”sqllineage -e analyze lineage : Error:
Command failed: sqllineage -e “CREATE OR REPLACE TABLE user_orders AS
SELECT u.user_id, u.user_name, u.email, o.order_id,
o.order_date FROM users u JOIN orders o ON u.user_id =
o.user_id;”nTraceback (most recent call last):rn File “”, line 198, in _run_module_as_mainrn File “”, line 88, in _run_codern File “C:Program
FilesPython312Scriptssqllineage.exemain.py”, line 7, in
rn File “C:Program
FilesPython312Libsite-packagessqllineagecli.py”, line 127,
in mainrn runner.print_table_lineage()rn File “C:Program
FilesPython312Libsite-packagessqllineagerunner.py”, line
179, in print_table_lineagern print(str(self))rn
^^^^^^^^^rn File “C:Program
FilesPython312Libsite-packagessqllineagerunner.py”, line
26, in wrapperrn self._eval()rn File “C:Program
FilesPython312Libsite-packagessqllineagerunner.py”, line
199, in _evalrn stmt_holder = analyzer.analyze(stmt,
session.metadata_provider)rn
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^rn File
“C:Program
FilesPython312Libsite-packagessqllineagecoreparsersqlfluffanalyzer.py”,
line 52, in analyzern statement_segments =
self._list_specific_statement_segment(sql)rn
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^rn File “C:Program
FilesPython312Libsite-packagessqllineagecoreparsersqlfluffanalyzer.py”,
line 83, in _list_specific_statement_segmentrn
config=FluffConfig.from_root(overrides={“dialect”:
self._dialect})rn
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^rn File
“C:Program
FilesPython312Libsite-packagessqlfluffcoreconfig.py”,
line 873, in from_rootrn c = loader.load_config_up_to_path(rn
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^rn File “C:Program
FilesPython312Libsite-packagessqlfluffcoreconfig.py”,
line 684, in load_config_up_to_pathrn user_config =
self.load_user_config() if not ignore_local_config else {}rn
^^^^^^^^^^^^^^^^^^^^^^^rn File “C:Program
FilesPython312Libsite-packagessqlfluffcoreconfig.py”,
line 672, in load_user_configrn return
self.load_config_at_path(user_home_path)rn
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^rn File “C:Program
FilesPython312Libsite-packagessqlfluffcoreconfig.py”,
line 611, in load_config_at_pathrn d =
os.listdir(os.path.expanduser(p))rn
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^rnPermissionError: [WinError 5]
Access is denied:
‘C:\Windows\system32\config’rn”,”timestamp”:”2024-09-03
10:44:56″}

I have tried below steps:

  • I have tried to change the “sqllineage” with location where sqllineage is located in my system. But still not working.

  • I also tried to run this command as administrator in the code.

  • Also checked the permission to allow sqllineage.exe to Run & execute.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật