Connect Redshift using Python Pyodbc – ODBC Driver Example

There are many ways to connect to the Redshift data warehouse appliance from Python or any other programming language. Most of the applications use either odbc or jdbc driver to connect to Amazon Redshift. In my other earlier post, we have discussed how to connect Redshift data warehouse from Python using jdbc driver. In this article, we will check method on connect Redshift using Python pyodbc and odbc driver with a working example. Page Content Introduction Setup Redshift ODBC Driver Configure Redshift ODBC Driver on Linux Configure Redshift ODBC on…

Continue ReadingConnect Redshift using Python Pyodbc – ODBC Driver Example
Comments Off on Connect Redshift using Python Pyodbc – ODBC Driver Example

Connect Redshift using Python and Jdbc Driver- Example

Redshift is one of the widely used MPP data warehouse appliance on the AWS cloud. AWS Redshift is popular because of its flexible features and benefits. Redshift supports both JDBC and OBDC drivers. You can use those drivers from any programming language to connect to Redshift. In this article, we will check how to connect Redshift using Python and Jdbc driver with a working example. Page Content Introduction Setup Redshift JDBC Driver Environment Install Jaydebeapi Python Module Set CLASSPATH to Driver Location Redshift JDBC Connection String Connect Redshift using JDBC…

Continue ReadingConnect Redshift using Python and Jdbc Driver- Example
2 Comments

Redshift RECORD Type, Usage and Examples

Similar to other procedural language, such as nzplsql, Redshift plpgsql supports RECORD variables. The Redshift RECORD type variable is similar to row types, but they have no predefined structure associated with it. Record type variables can be used inside Redshift stored procedures. They are used in selections or FOR loops to hold one row from a SELECT operation. Redshift RECORD Type Variable A RECORD in Redshift plpgsql is not a true data type, but only a placeholder. Record type variables assume the actual row structure of the row that they…

Continue ReadingRedshift RECORD Type, Usage and Examples
Comments Off on Redshift RECORD Type, Usage and Examples

Redshift Conditional Statements – IF, LOOP, WHILE, FOR, CONTINUE and EXIT

The Redshift SQL conditional statements are a useful and important part of the plpgsql language. You can use Redshift control structures to perform some critical decisions based on data and manipulate SQL data in a flexible and powerful way. In Redshift, you can use conditional statements to control the flow of execution of a SQL script based on conditions. You can use these Redshift conditional statements for data manipulation in your complex SQL queries. Redshift Conditional Statements The Redshift conditional control flow statements are categorized into two parts: Conditional control…

Continue ReadingRedshift Conditional Statements – IF, LOOP, WHILE, FOR, CONTINUE and EXIT
Comments Off on Redshift Conditional Statements – IF, LOOP, WHILE, FOR, CONTINUE and EXIT

Redshift Stored Procedure Return Result Set – Working Example

Redshift stored procedures are used to encapsulate business logic such as transformation, data validation, etc. You can also use the stored procedure to return the result set in your applications. Typically, stored procedure returns a unique value, it can also return result set in the form of cursor or temporary tables. In this article, we will check Redshift Stored Procedure Return Result set with an example. Redshift Stored Procedure Return Result Set Return records from the Redshift stored procedure is bit different compared to other postgreSQL databases such as Netezza.…

Continue ReadingRedshift Stored Procedure Return Result Set – Working Example
Comments Off on Redshift Stored Procedure Return Result Set – Working Example

How to Create and Use Redshift Cursor Variable? – Examples

Just like many other SQL procedural languages, the latest version of Redshift plpgsql supports cursor type variables. You can use a cursor to retrieve a few rows at a time from the result set of a larger query. You can use the cursor type inside Redshift stored procedures (SP). They are used in selections and FOR loops to hold one row from a SELECT operation. In this article, we will check how to create and use Redshift cursor variable inside your stored procedure. Redshift Cursor Variable As mentioned earlier, Redshift…

Continue ReadingHow to Create and Use Redshift Cursor Variable? – Examples
Comments Off on How to Create and Use Redshift Cursor Variable? – Examples

Redshift Dynamic SQL Queries and Examples

When you are working on the various data sources and different kind of SQL queries, there may be situations where you want to generate dynamic SQL queries dynamically based on your requirement. In Redshift you can PREPARE SQL statement and EXECUTE it. Redshift also support use of EXECUTE command in Redshift stored procedures. In this article, we will check Redshift Dynamic SQL Queries, how to PREPARE them and run using EXECUTE statements. The dynamic SQL in Redshift can be useful in many scenarios, such as when you need to execute…

Continue ReadingRedshift Dynamic SQL Queries and Examples
Comments Off on Redshift Dynamic SQL Queries and Examples

Redshift Connection Issues – Causes and Resolution

Redshift is a petabyte data warehouse provided by AWS cloud. If you have created Redshift cluster by default it will be publicly accessible. Amazon has taken a lot of measure to secure Redshift cluster from unforeseen events such as unauthorized access from the network. In this article, we will discuss common Redshift connection issues, causes and resolution. Redshift Connection Issues Accessing redshift from EC2 instance is easy as you don't have to take any security measures as EC2 instance is also created in the AWS cloud. But if you are…

Continue ReadingRedshift Connection Issues – Causes and Resolution
Comments Off on Redshift Connection Issues – Causes and Resolution

Working with Amazon Redshift Stored Procedure

Amazon Redshift supports stored procedures written in PL/pgSQL, a dialect of the PostgreSQL database language. Stored procedures in Redshift are used to encapsulate logic on the database side and can be executed by multiple client applications, improving code reusability and reducing the amount of duplicated code in your applications. In this article, we will check how to create a stored procedure in Redshift using simple examples. Amazon Redshift Stored Procedure Overview Amazon Redshift stored procedures are used to encapsulate the data migration, data validation and business specific logic's and same time…

Continue ReadingWorking with Amazon Redshift Stored Procedure
Comments Off on Working with Amazon Redshift Stored Procedure

Amazon Redshift Features – Benefits and uses

Amazon Reshift is one of its kind cloud data warehouse appliance on the AWS cloud. It is lightning-fast, Massively parallel processing (MPP), scalable data warehouse and data processing solutions without a massive investment in infrastructure. Redshift provides access to other tools like storage service S3, data lake, machine learning modules, etc. Amazon Redshift is a lot different compared to other MPP data warehouse appliances like Netezza, Greenplum, etc. In this article, we will check Amazon Redshift features, benefits and its uses. Amazon Redshift Features Redshift is a great Platform as…

Continue ReadingAmazon Redshift Features – Benefits and uses
Comments Off on Amazon Redshift Features – Benefits and uses