我想知道是否有一个库可以抽象以下 DBMS 操作:
- 加载数据(一堆 CSV 文件或 SQL 插入语句)
- 执行一堆查询
- 获取上述内容的测量值(吞吐量、延迟等)
- 报告生成(图表等) )基于以上。
我有一堆针对不同数据库(例如 TPC-H、SSB 等)的 DDL/DML 文件,我希望能够加载数据并对许多 DBMS 运行查询,而不必担心特定 DBMS 的特殊性(MySQL、SQLServer、Oracle 等)。
到目前为止我发现的最接近的东西是这些。它们的问题在于,它们特定于给定的工作负载(大多数情况下是 TPC),因为域特定对象被建模为类(Java 或 C++)。我正在寻找的是独立于域且与 DBMS 无关的。
I wonder if there's a library that abstracts the following DBMS operations:
- Load data (a bunch of CSV files or SQL insert statements)
- Execute a bunch of queries
- Get measurements for the above (throughput, latency, etc)
- Report generation (graphs, etc.) based on the above.
I have a bunch of DDL/DML files for different databases (for example TPC-H, SSB, etc) and I want to be able to load the data and run queries to many DBMSs without having to worry about the particularities of the specific DBMS (MySQL,SQLServer,Oracle, etc).
The closes thing I've found so far are these. The problem with them is that they’re specific for a given workload (TPC in most of the cases) in the sense that the domain specific objects are modeled as classes (Java or C++). What I'm looking for is domain-independent and DBMS-agnostic.
发布评论
评论(3)
这可以通过 DbUnit 和 JMeter 的组合来完成。
DbUnit 是独立于 DBMS 的(尽可能),可用于将 CSV 文件加载到数据库中。
JMeter 可以针对任何具有 JDBC 驱动程序的 DBMS 运行 SQL 语句,并可用于测量每个语句的性能。
This could be done with the combination of DbUnit and JMeter.
DbUnit is DBMS independent (as far as possible) and can be used to load CSV files into the database.
JMeter can run SQL Statements against any DBMS that has a JDBC driver and can be used to measure the performance of each statement.
我认为这里最好使用 ORM。类似于 Ruby 的 ActiveRecord、Perl 的 Class:DBI 或 DBIx::Class 甚至 java 的 Hibernate 。
Ruby 的 ActiveRecord 已经为使用 MySQL、PostgreSQL、SQLite、Oracle、SQLServer 和 DB2 提供了内置支持,而 hibernate 似乎可以使用更多的数据库(Hibernate 支持的数据库)
使用 ORM,您可以采用统一的方式来处理数据库。当然,查询必须用 ORM 语言(Ruby、Perl、Python、Java 等)编写,而不是 SQL。但通过这种方式,您还可以获得在所有数据库引擎中执行等效操作的确定性,并且您只需为所有数据库维护一个“DDL/DML”指令文件。
希望这有帮助
I think here it would be best to use an ORM. Something like Ruby's ActiveRecord, Perl's Class:DBI or DBIx::Class or even java's Hibernate .
Ruby's ActiveRecord already offers builtin support for working with MySQL, PostgreSQL, SQLite, Oracle, SQLServer, and DB2, while hibernate seems to work with much more DBs (Hibernate Supported Databases )
Working with an ORM, you have a unified way of working with the DBs. Of course, the queries will have to be written in ORMs language (Ruby, Perl, Python, Java, etc) and not in SQL. But in this way, you also obtain the certainty that equivalent operations are executed in all DB engines and you only have to maintain one file of 'DDL/DML' instructions, for all DBs.
Hope this helps
OLTPBench 符合所有规定的要求:
OLTPBench fits the bill for all stated requirements: