Skip to content

call luadbi-duckdb failed #16

@l1t1

Description

@l1t1

I wrote a lua code as following

DBI = require "DBI"

dbd, err = DBI.Connect( 'DuckDB', 'lua_duckdb', 'dbuser', 'password' )
assert(dbd, err)

dbd:autocommit(true)
 statement = dbd:prepare( "create table table_1 as select 15 id, 'abc' column1,'张先生' column2,'2025-09-22' column3 ;" )
 statement:execute()
statement = dbd:prepare( "select * from table_1 where id = $1;" )
statement:execute( 15 )

for row in statement:rows(true) do
print(row['id'])
	print(row['column1'])
	print(row['column2'])
	print(row['column3'])

end
return row['column2']

save it in the d1 cells in demo.xlsx,and call it by following steps

D load lua;
D load rusty_sheet;
D select lua(d) from read_sheet('demo.xlsx',header=0);
┌───────────────────────────────────────────────────────────────────────────────────────────────┐
│                                            lua(d)                                             │
│                                            varchar                                            │
├───────────────────────────────────────────────────────────────────────────────────────────────┤
│ /usr/local/share/lua/5.4/DBI.lua:54: Cannot load driver DuckDB. Available drivers are: (None) │
└───────────────────────────────────────────────────────────────────────────────────────────────┘

but if I run it with a lua scripts with lua, it works

.system lua duc.lua
15
abc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions