I'm on the look for an ORM mapper for SQL Server on Node.js. Long story short, we have a SQL Server running and now we want to use node.js to build web services pulling data from the database.
我正在寻找Node.js上的SQL Server的ORM映射器。简而言之,我们运行了一个SQL Server,现在我们想使用node.js来构建从数据库中提取数据的Web服务。
Do you know any ORM that supports SQL Server on Node.js?
你知道在Node.js上支持SQL Server的任何ORM吗?
I know that there is this tedious which can help connect to SQL Server but it does not have ORM.
我知道有这种乏味可以帮助连接到SQL Server,但它没有ORM。
Thanks
谢谢
5 个解决方案
#1
9
SQL Server so far hasn't gotten a great deal of support yet in the Node.js community. And, since most of the Node.js ecosystem is community-driven, your options will likely be rather limited.
到目前为止,SQL Server尚未在Node.js社区中获得大量支持。而且,由于大多数Node.js生态系统都是由社区驱动的,因此您的选择可能会相当有限。
That's not to say there aren't plans to add support for it; just that not many have achieved it yet. Example: The author of sequelize
has stated intent to add support eventually.
这并不是说没有计划增加对它的支持;只是没有多少人实现它。示例:sequelize的作者表示有意最终添加支持。
For now, if it's enough to get plain Object
s with columns as keys, Microsoft's own msnodesql
can be a good option with its query()
method:
现在,如果它足以获得带有列作为键的普通对象,那么Microsoft自己的msnodesql对于其query()方法来说是一个不错的选择:
sql.query(conn_str, "SELECT 1 as X, 'ABC', 0x0123456789abcdef ", function (err, results) {
assert.ifError(err);
var buffer = new Buffer('0123456789abcdef', 'hex');
var expected = [{ 'X': 1, 'Column1': 'ABC', 'Column2': buffer}];
assert.deepEqual(results, expected, "Results don't match");
done();
});
#2
18
According to sequelize's documentation, orm support for sql-server is available in version 2.0 (released on Feb. 10, 2015, previously added on Dec. 22, 2014's release candidate).
根据sequelize的文档,sql-server的orm支持在2.0版本中可用(2015年2月10日发布,之前在2014年12月22日发布的候选版本中添加)。
#3
2
I like Node-odbc, I think some kind of ODBC abstraction is probably best all RDBMS' with NodeJS
我喜欢Node-odbc,我认为某种ODBC抽象可能是所有RDBMS与NodeJS最好的
#4
0
Have a look at mssql-orm. It supports writing large object graphs to SQL Server, but has a very lightweight API:
看看mssql-orm。它支持将大对象图写入SQL Server,但它具有非常轻量级的API:
var person = db.model({table: 'people'});
var bob = person({
name: 'bob'
});
bob.save();
#5
0
I am using Bookshelf ORM, it has built-in support for MS SQL Server via its dependency on Knex.js, though it's not explicitly listed on the Bookshelf website.
我正在使用Bookshelf ORM,它通过依赖于Knex.js内置了对MS SQL Server的支持,尽管它没有在Bookshelf网站上明确列出。
Specify client: 'mssql'
on initialization of Bookshelf.
在Bookshelf的初始化时指定客户端:'mssql'。
#1
9
SQL Server so far hasn't gotten a great deal of support yet in the Node.js community. And, since most of the Node.js ecosystem is community-driven, your options will likely be rather limited.
到目前为止,SQL Server尚未在Node.js社区中获得大量支持。而且,由于大多数Node.js生态系统都是由社区驱动的,因此您的选择可能会相当有限。
That's not to say there aren't plans to add support for it; just that not many have achieved it yet. Example: The author of sequelize
has stated intent to add support eventually.
这并不是说没有计划增加对它的支持;只是没有多少人实现它。示例:sequelize的作者表示有意最终添加支持。
For now, if it's enough to get plain Object
s with columns as keys, Microsoft's own msnodesql
can be a good option with its query()
method:
现在,如果它足以获得带有列作为键的普通对象,那么Microsoft自己的msnodesql对于其query()方法来说是一个不错的选择:
sql.query(conn_str, "SELECT 1 as X, 'ABC', 0x0123456789abcdef ", function (err, results) {
assert.ifError(err);
var buffer = new Buffer('0123456789abcdef', 'hex');
var expected = [{ 'X': 1, 'Column1': 'ABC', 'Column2': buffer}];
assert.deepEqual(results, expected, "Results don't match");
done();
});
#2
18
According to sequelize's documentation, orm support for sql-server is available in version 2.0 (released on Feb. 10, 2015, previously added on Dec. 22, 2014's release candidate).
根据sequelize的文档,sql-server的orm支持在2.0版本中可用(2015年2月10日发布,之前在2014年12月22日发布的候选版本中添加)。
#3
2
I like Node-odbc, I think some kind of ODBC abstraction is probably best all RDBMS' with NodeJS
我喜欢Node-odbc,我认为某种ODBC抽象可能是所有RDBMS与NodeJS最好的
#4
0
Have a look at mssql-orm. It supports writing large object graphs to SQL Server, but has a very lightweight API:
看看mssql-orm。它支持将大对象图写入SQL Server,但它具有非常轻量级的API:
var person = db.model({table: 'people'});
var bob = person({
name: 'bob'
});
bob.save();
#5
0
I am using Bookshelf ORM, it has built-in support for MS SQL Server via its dependency on Knex.js, though it's not explicitly listed on the Bookshelf website.
我正在使用Bookshelf ORM,它通过依赖于Knex.js内置了对MS SQL Server的支持,尽管它没有在Bookshelf网站上明确列出。
Specify client: 'mssql'
on initialization of Bookshelf.
在Bookshelf的初始化时指定客户端:'mssql'。