Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a schema in redshift

Tags:

schema

I would like to know how to set the current or default schema on redshift. Some documentation I have read states that this is possible with the SET command, but I don't believe this is accurate. I understand the search path can be altered, but I would like to know whether there is another way to set the default schema, something similar to "SET CURRENT_SCHEMA TO 'desired-schema-name'".

like image 350
BrianB Avatar asked May 04 '17 14:05

BrianB


People also ask

How do you grant access to a schema in Redshift?

To grant usage of external tables in an external schema, grant USAGE ON SCHEMA to the users that need access. Only the owner of an external schema or a superuser is permitted to create external tables in the external schema. To transfer ownership of an external schema, use ALTER SCHEMA to change the owner.

How do you define a schema?

In computer programming, a schema (pronounced SKEE-mah) is the organization or structure for a database, while in artificial intelligence (AI) a schema is a formal expression of an inference rule. For the former, the activity of data modeling leads to a schema.

What are the schema commands?

A SCHEMA is a logical container for objects such as tables, views, indices, sequences, triggers, functions, aggregates and procedures. Schema access and modification is strictly controlled using the user role and authorization scheme.


1 Answers

I don't think there is another way, but altering the search path should be as short to write and functionally be the same as what you're with the difference of one word only (search_path instead of current_schema)

SET search_path TO schema; (from section 5.7.3: https://www.postgresql.org/docs/9.1/static/ddl-schemas.html)

A similar question was answered here and has instructions to permanently set the default search path for individual users or the DB in question: How does the search_path influence identifier resolution and the "current schema"

like image 199
Magnus Lidman Avatar answered Nov 07 '22 08:11

Magnus Lidman