Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connecting to SQL server #58

Closed
Lincoln-Hannah opened this issue Aug 26, 2024 · 7 comments
Closed

connecting to SQL server #58

Lincoln-Hannah opened this issue Aug 26, 2024 · 7 comments

Comments

@Lincoln-Hannah
Copy link

Lincoln-Hannah commented Aug 26, 2024

Could you add a documentation example of connecting to MS SQL Server ?

@drizk1
Copy link
Member

drizk1 commented Aug 28, 2024

Hi @Lincoln-Hannah

The most recent doc / docstrings now include an example. I have included the example below. Plz let me know if you have any further questions or open further issues on TidierDB

The connection is a simple wrapper of the ODBC Connection function

using TidierDB
using ODBC

conn = connect(mssql(), "DRIVER={ODBC Driver 18 for SQL Server};SERVER=host,1433;UID=sa;PWD=YourPassword;Encrypt=no;TrustServerCertificate=yes")

@Lincoln-Hannah
Copy link
Author

I don't have a method of type connect(::mssql, ::String)
I only have the below.
Its possible by package didn't install correctly.

connect(::duckdb; kwargs...)										 TidierDB.jl:321
connect(::duckdb, token::String)	     							 TidierDB.jl:376
connect(::duckdb, db_type::Symbol; access_key, secret_key, aws_access_key_id, aws_secret_access_key, aws_region)     TidierDB.jl:347
connect(::databricks, identifier::String, auth_token::String, database::String, schema::String, warehouse::String)   TidierDB.jl:340
connect(::snowflake, identifier::String, auth_token::String, database::String, schema::String, warehouse::String)	 TidierDB.jl:334

@Lincoln-Hannah Lincoln-Hannah changed the title some requests connecting to SQL server Aug 28, 2024
@drizk1
Copy link
Member

drizk1 commented Aug 28, 2024

You'll need to use v.3.2.

Although based on your error it may be UpToDate already.

TidierDB has also moved to package extensions.

So you will need to also do the following to pull in the extended functionality.

using TidierDB
using ODBC

To install a specific version you can do the following

Pkg.add(name="TidierDB", version="0.3.2")

@Lincoln-Hannah
Copy link
Author

Lincoln-Hannah commented Aug 28, 2024

ERROR: Unsatisfiable requirements detected for package TidierDB [86993f9b]:
 TidierDB [86993f9b] log:
 ├─possible versions are: 0.1.0-0.3.1 or uninstalled
 └─restricted to versions 0.3.2 by an explicit requirement — no versions left

If I just wait a month or so, will this likely be sorted?

@drizk1 drizk1 transferred this issue from TidierOrg/Tidier.jl Aug 28, 2024
@drizk1
Copy link
Member

drizk1 commented Aug 28, 2024

Hmm, thats strange, normally it should be nearly immediate.

I was just able to successfully do it.

using Pkg; Pkg.add(name = "TidierDB", version = "0.3.2")
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
    Updating `~/.julia/environments/v1.10/Project.toml`
  [86993f9b] ~ TidierDB v0.3.2 `https://github.com/TidierOrg/TidierDB.jl#main` ⇒ v0.3.2
    Updating `~/.julia/environments/v1.10/Manifest.toml`
  [86993f9b] ~ TidierDB v0.3.2 `https://github.com/TidierOrg/TidierDB.jl#main` ⇒ v0.3.2

(@v1.10) pkg> status TidierDB
Status `~/.julia/environments/v1.10/Project.toml`
  [86993f9b] TidierDB v0.3.2

Another option would be the following (which will be the latest version as well.

using Pkg; Pkg.add(url = "https://github.com/TidierOrg/TidierDB.jl" )

@Lincoln-Hannah
Copy link
Author

i think its a fire-wall blocking the package on my end.
I'll keep trying. Many thanks.

@drizk1
Copy link
Member

drizk1 commented Aug 28, 2024

Sure thing.

One other option if older versions are available would be to try v0.2.4 and then library in ODBC, and use ODBC.Connection to establish a connection.

From there you could set_sql_mode(:mssql) ( note the symbol is because it's an older version before the switch in v0.3.0) and that should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@Lincoln-Hannah @drizk1 and others