arundhaj

all that is technology

Creating AWS S3 Presigned URL for uploading and downloading files in Python using Boto3

 

In this video I'll show how create AWS S3 presigned URL for uploading and downloading files in Python using Boto3.

You can find the code snippet below

from pprint import pprint

import boto3

session = boto3.Session(profile_name='arundhaj')

s3_client = session.client('s3')

s3_bucket_name = 'codepossibility-presigned'
object_name = 'TestUploadFile.txt'


def create_bucket():
    response …

Using SQLAlchemy Expression for Insert

 

In this article, I'll show how to build SQLAlchemy expressions for various cases of inserting data to the table

For simple insert,

# Prepare the statement
insert_stmt = insert(TableName).values(Column1='Column1Value', Column2='Column2Value')

# Execute the statement
insert_result = db.session.execute(insert_stmt)

# Get the Primary Key of the newly inserted record …

Customizing AWS Amplify color scheme for Angular

 

In this article, I'll show you how to customize AWS Amplify color scheme for Angular apps.

Following are the list of variables with the default values exposed by AWS Amplify for customization.

:root {
  --amplify-primary-color: #ff9900
  --amplify-primary-contrast: var(amplify-white)
  --amplify-primary-tint: #ffac31
  --amplify-primary-shade: #e88b01
  --amplify-secondary-color: #152939
  --amplify-secondary-contrast: var(amplify-white)
  --amplify-secondary-tint …

Dynamically Change Page Title for each Route in Angular

 

In this article, I'll show you how to dynamically change page title of an Angular app based on Route configuration.

Let say we have three components HomeComponent, MainComponent and AboutComponent. The corresponding route definition as in app-routing.module.ts file

import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular …

Multiple head revisions present ERROR in Flask Migrate

 

In this article, I'll show you the cause of the following error and how to fix it.

ERROR [root] Error: Multiple head revisions are present for given argument 'head'; 
    please specify a specific target revision, '<branchname>@head' to narrow 
    to a specific head, or 'heads' for all heads

This error …

Python Pipenv quick start guide for managing packages and virtualenv

 

In this video I'm going to show you how to start using pipenv for your python projects.

Pipenv is a packaging tool which automatically creates and manages virtualenv and packages.

# To create a new virtual environment
$ mkdir pipenv-demo && cd pipenv-demo
$ pipenv shell
(venv) $ cat Pipfile

# To install a package and …

Using SQLAlchemy Expression for Partial JSON Update

 

In this article, I'll show how to partially update JSON column using SQLAlchemy expressions in MySQL database.

Say, we have a table named TableName with a JSON column named JsonColumn and the values in this JSON column is in the following format;

{
    "JsonAttribute": 5,
    "AnotherJsonAttribute": "Hello"
}

SQL statement to update …