tediousjs / tedious

Node TDS module for connecting to SQL Server databases.
http://tediousjs.github.io/tedious/
MIT License
1.57k stars 436 forks source link

Deno Compatability #1246

Open tracker1 opened 3 years ago

tracker1 commented 3 years ago

Just curious if there's been any consideration or research done to what would be needed to make this library work for Deno.

There's a stack overflow question[1] regarding this, that seems to be related to missing node crypto shims. Not sure if this is even realistically approachable currently, but would be cool if it were.

Mainly looking because I thought it would be nice if nessie[2] could support mssql for migrations.

[1] https://stackoverflow.com/questions/65762593/error-when-connecting-to-sql-server-in-deno-cannot-find-module-crypto [2] https://github.com/halvardssm/deno-nessie

tracker1 commented 3 years ago

Aside, I've been doing a simple project, with version scripts via Node.js for database versions/migrarions, but being able to roll a standalone executable for this would be a really nice feature for me, that deno readily supports.

IanChokS commented 3 years ago

I don't think we've ever considered providing support for Deno at the moment. If there's a lot of interest in the future, then perhaps? 🤷‍♂️

sdesalas commented 2 years ago

FYI https://medium.com/p/87b965ad2c8d

coreybutler commented 2 years ago

I think there is greater demand for this than may be apparent. I consistently hear things like "if Deno supported SQL Server, I'd drop Node for Deno right now". The challenge is many people in the Deno community don't think to look for "tedious"... they think to look for "mssql" or just "sql server". They simply aren't aware there is a project like this one, so you won't hear from them.

Anyhow, I'd be interested in Deno support.

josh-hemphill commented 2 years ago

ESM.js does a lot of automatic conversions if you import from there, but it can't polyfill Node's dgram module which is where it gets hung up right now (gets much farther and just blocks on dns module if you use the unstable and compat flags). Deno's FFI is really solid now. I wonder if in the meantime it would be possible to use system libs (.dll/.so) to access ODBC connections.

josh-hemphill commented 2 years ago

I just explored using denoify to create builds for Deno from the existing codebase. You can check it out on my fork: https://github.com/josh-hemphill/tedious/tree/deno-testing There's still a couple of libraries/ployfills that are missing a few properties, but I think that's all not too hard to overcome. Though there's a lot of incompatibility in some of the older or deprecated Node APIs. I think it would help a lot to migrate to some of Node's newer more web-compliant APIs and change the TSC compiler settings to the more ESM-first ones.

tracker1 commented 2 years ago

@josh-hemphill I've been thinking that a wasm target, or ffi bridge library to a binary built with rust might be the shortest path... Not sure how good the story is for that... would be nice to see some effort from MS on this, similar for a lot of the Azure client libraries at this point.

edit: https://github.com/prisma/tiberius

josh-hemphill commented 2 years ago

Yeah, I might look at that. Deno recently said they're committing to making the Nodejs compat libraries cover most node packages, so we might eventually get the few remaining things resolved for using denoify, but there's still some incompatibility in the usage of deprecated APIs, so maybe a later version of Node may make this Deno compatible just by forcing the removal of deprecated APIs and moving to ESM-first in a lot of things.

mikerobi commented 1 year ago

Here is the Deno issue for this: https://github.com/denoland/deno/issues/18303

tracker1 commented 1 year ago

@mikerobi thanks for the link to the upstream issue... I knew I was finally able to import the npm:mssql module without issue... looks like the starttls for npm compat still needs some work.

I find working with Deno a lot nicer than Node in general, but there's a lot of ground to move to get there for a lot of things. Fortunately, I'm not working with MS-SQL regularly in my current job.

v1d3rm3 commented 4 months ago

I think there is greater demand for this than may be apparent. I consistently hear things like "if Deno supported SQL Server, I'd drop Node for Deno right now". The challenge is many people in the Deno community don't think to look for "tedious"... they think to look for "mssql" or just "sql server". They simply aren't aware there is a project like this one, so you won't hear from them.

Anyhow, I'd be interested in Deno support.

Totally agree! Ecosystem is fundamental. Look at Java, there're a lot of better/modern languages, but Java has the best ecosystem, so, a lot of companies use it.