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

Role as part of the connection string is not being recognize. #42

Closed
eddychansnowflake opened this issue Jun 20, 2018 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@eddychansnowflake
Copy link

It won't change the role from the default to ACCOUNTADMIN even though its defined in the connection string, nor is the database and maybe schema parameters are recognized.

        using (IDbConnection conn = new SnowflakeDbConnection())
        {
            conn.ConnectionString = "account=demo16;host=XXXXX.snowflakecomputing.com;user=eddy;password=XXXXXXX;db=edy;schema=public;role=accountadmin;warehouse=etl" ;
            conn.Open();

            IDbCommand cmd = conn.CreateCommand();
            cmd.CommandText = "select * from edy.public.eddy1;";
            IDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                Console.WriteLine(reader.GetString(0));
            }

            conn.Close();
        }

I had to add in these commands to properly switch the context:
IDbCommand cmd = conn.CreateCommand();
cmd.CommandText = "use role accountadmin";
cmd.ExecuteNonQuery();

            conn.CreateCommand();
            cmd.CommandText = "use database edy";
            cmd.ExecuteNonQuery();

            conn.CreateCommand();
            cmd.CommandText = "use schema public";
            cmd.ExecuteNonQuery();
@howryu
Copy link
Contributor

howryu commented Jun 21, 2018

Fixed in #45

@howryu howryu closed this as completed Jun 21, 2018
@howryu howryu added the bug label Jun 21, 2018
@howryu howryu self-assigned this Jun 21, 2018
@howryu howryu added this to the v1.0.2 milestone Jun 21, 2018
@eddychansnowflake
Copy link
Author

Thanks for the quick turnaround, confirmed that this is fixed.

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

No branches or pull requests

2 participants