A newbie to Snowflake and I cannot use the database navigator to look at a table.
It gives me the following error: "Cannot perform DESCRIBE. This session does not have a current database. Call 'USE DATABASE', or use a qualified name."
I changed the context to use the right database.
I changed my role to SYSADMIN.
I entered "USE DATABASE CITIBIKE".
Still no joy.
You can try specifying your database while creating the connection with snowflake as below:
const connection = snowflake.createConnection({
username: "username",
password: "password",
account : "accountname",
database: "database name"
});
Source :
https://docs.snowflake.com/en/user-guide/nodejs-driver-use.html
Note : you can also specify schema, warehouse and role.
this worked for me
Are you using a worksheet or have you tried at the worksheet level with the necessary permissions to the object? Perhaps try using the qualified name? For example, if you're trying to describe a table in Snowflake:
desc table database_name.schema_name.table_name
Please note if any of the objects here have special characters, were stored in lowercase, or have spaces, you may need to put double quotes around them.
Edit: After further investigation and understanding of the issue, this is actually a UI issue the Snowflake Dev team is working to resolve. Hoping to see a fix in the next release.
Related
I am manually creating the identity tables for a new ASP.NET 6 project following this tutorial. Such tutorial is for MS SQL Server and I am using PostgreSQL so I made the appropriate modifications. Although the process is straightforward, I have a problem when reaching the update-database step where I get the following error: "Couldn´t set schema (Parameter ´schema')". My connection string is as follows: "host=localhost; database=testdb001; schema=testdb001; port=5433; user id=some-user; password=some-password;". I found that such error disappears and the identity tables are successfully created if I remove the schema parameter in the connection string but tables are created in the public schema that PostgreSQL automatically includes when a new DB is created. However, I do not want this to happen because I want to use another schema name. I visited connection strings website for PostgreSQL (https://www.connectionstrings.com/postgresql/) and I see a link for Npgsql, and all the examples here do not contain the schema parameter. This is the first time that I use npgsql. Is there a way to create the identity tables in a specific schema name?
Maybe a workaround is to specify a schema name in the search_path parameter in postgresql.conf file but this would lead to add a name every time I define a new schema. I think that the schema name in the connection string is a great choice but I wonder why this is not accepted for npgsql.
Respectfully,
Jorge Maldonado
I found the solution.
For npgsql you must use search path as a connection string parameter instead of schema. So a connection string is as follows
"host=localhost; database=testdb001; search path=testdb001; port=5433; user id=some-user; password=some-password;"
and not
"host=localhost; database=testdb001; schema=testdb001; port=5433; user id=some-user; password=some-password;"
Regards,
Jorge Maldonado
I have created on load table. However, while viewing data I'm getting error below:
[Microsoft][ODBC SQL Server Driver][SQL Server] Invalid object name 'LOAD_TAL_Tablename'
May I know what is the problem? How to resolve this?
Very old topic, but still worth to answer.
The reason is invalid syntax, as mentioned above. I received the same error and then investigated in logs that although I am loading data between different databases, Wherescape did not add reference to appropriate source database in generated SQL code. So, by default, it was referring to target database when looking for source table.
To fix this, see below steps:
Find your soruce connection and open it's Properties
On Properties tab, in Source System section make sure that the field Database ID is filled in with name of your database. If not - put it there
Try to load tables and look at SQL used to load the table in logs. Make sure your reference to source table is three-part (this time it should point to correct database).
Check whether the object exists (natch!) and more specifically what schema it is located in. By default RED will expect to see it in the dbo schema and I have seen in the past that if you are using AD and groups for authentication/authorisation objects may get created under the default schema of the automatically-created user (if that is the case, delete them manually in SSMS and set the Default Schema mapping for the user to "dbo")
Of course, you have actually /created/ the table haven't you? Just defining it in RED will only create tyhe meta data definition. Make sure you have right-clicked and chosen Create/ReCreate etc... (though to be fair if this is where you are stuck ...)
HTH,
Mark
Can you post the code that you used to create the table as well as the code you are running when you get the error. It just sounds like a syntax issue.
Can I use OPENDATASOURCE (or another mechanism) from a Stored Procedure to connect to the same database as a different user? If so, how?
The database is meant to be deployed to several customers, and replicated by them as many times as they want to, etc. For this reason, I CANNOT HARDCODE the database server's name or the database's name.
(I tried using OPENDATASOURCE, but it only accepts hardcoded connection strings.)
Might EXECUTE AS work in your situation? http://msdn.microsoft.com/en-us/library/ms181362.aspx
You can set up a Linked Server to connect to the remote server using the login's current security context (or other options as it applies to your situation).
From your stored procedure, you could access it with something like SELECT * FROM mylinkedservername.mylinkedserverdatabase.dbo.mytable
But you say you want to connect to the same database but using a different login? You're looking for impersonation. Perhaps you can do this making a Linked Server that references itself, I haven't tried it. Search Microsoft Help documentation for how to set it up normally and test if it does what you're looking to do.
I have been tasked with comparing two oracle schema with a large number of tables to find the structural differences in the schema. Up until know I have used the DB Diff tool in Oracle SQL Developer, and it has worked very well. The issue is that now I need to compare tables in a user that I cannot log into , but I can see it through the other users section in SQL developer. The issue is that whenever I try to use the diff tool to compare those objects to the other schema it does not work. Does anyone have any idea how to do this? It would save me a very large amount of work. I have some basic SQL knowledge if that is whats needed. Thanks.
If you have been GRANTed permissions in that other schema, issue an
alter session set current_schema = OTHER_SCHEMA_NO_QUOTES_REQUIRED;
the run whatever tool.
Otherwise, it's select * from all_tables where owner = OTHER_USER;, 'select * from all_indexes where ...` etc.
Just reviving this question with a correct answer.
If you can get your DBA to grant you proxy through you can do the following without knowing the password of the end schema:
ALTER USER {use you do not have pw to - lets call it ENDSCHEMA} GRANT CONNECT THROUGH {user you have pw for - lets call it YOURSCHEMA};
Then you create a connection in SQL Developer where:
username: YOURSCHEMA[ENDSCHEMA]
password: YOURSCHEMA password
Then you can proceed and do a Database Diff on both schemas and never knowing the password for ENDSCHEMA.
FIRST You have to launch
ALTER SESSION SET CURRENT_SCHEMA = SCHEMA;
BUT ALSO IN THE FIRST SCREEN OF DIFFERENCES TOOL YOU HAVE TO CHOOSE FOR DDL COMPARISON OPTIONS - SCHEMA - "MANAGE" (NOT CONSOLIDATE)
(I have Sql Developer with italian interface, so I translated the options, the names could be a little different)
It works for me
Easily compare every things in two or more schemas using toad for oracle as in this pics
Step 1:
Step 2: compare window will appear to add schemas you want to compare (by default connected schema will be the one above) then click next,
Step 3: select objects you want to compare in both schemas then run
I'm trying to drop a database from PgAdmin 3 and I get this error message:
ERROR: can't delete current database
SQL state: 55006
how can I force the delete/fix this error, of this database?
Quick fix in PgAdmin: just create another empty database. Select it. Delete the first one. Voila.
You can also connect to the command line without selecting a specific database, and drop your database.
The problem here is not that other users are connected to the database, but that you are.
This post by Leeladharan Achar was helpful for me in working with this error.
It essentially boils down to:
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'target_db'
AND pid <> pg_backend_pid();
DROP DATABASE 'target_db';
Simplest fix for this is restart the postgresql. After that You can get rid of database!
If you want to use the pgAdmin4 interface, you have to first delete/drop the db, then, before waiting for the error, you have to immediatelly disconnect from the same database, then it gets deleted without problem.
Instead of creating new database he can simply connect to postgres database, which is created by default in all new PostgreSQL installations. And even if it is not there - template1 should be always there.
The best method to drop user is below mentioned
Like i have a user name is "X" and it have access permission to database name : "Test" .
And now we are created connection with "Test" database
If we try: drop user "X" this will be definality show below mentioned error:
ERROR: user "X" cannot be dropped because the user has a privilege on some object SQL State=55006
First of all connection should not be created with "Test" db.because it currently use so we are not able to delete the user.
create connection with any of database except eg "Test"
Now again try
drop user test
It should be worked fine on my side,let me know if you are facing issue on your side
The easiest and perhaps the neatest fix is to go to services and stop the PostgreSQL server and then start it, and then run the drop database yourdbname; command again. That should disconnect any sessions and allow you to drop the current database.