更新时间:2023-01-23 09:36:41
如果您的SQL是预定义的,您***的选择是将CSV加载到数据库中并对其执行查询。
Apache Derby是一个可行的选项,因此 MySQL ,甚至还有 CSV存储引擎或 PostgreSQL 。
您的SQL是否使用任何专有功能/扩展?如果是这样,这可能会限制您的选择。
I need to apply an SQL query to CSV files (comma-separated text files). My SQL is predefined from another tool, and is not eligible to change. It may contain embedded selects and table aliases in the FROM part.
For my task I have found two open-source (this is a project requirement) libraries that provide JDBC drivers:
These are the problems I encountered:
From the 4 things I considered/tried, only 3 and 4 seem to me viable. Any advice on these, or any other way in which I can query my CSV files?
Cheers
If your SQL is predefined and cannot be changed your best option is to load your CSV into a database and run queries against it.
Apache Derby is a viable option, so are MySQL, which even has a CSV storage engine or PostgreSQL.
Does your SQL use any proprietary functions / extensions? If so, that may limit your choices.