Category Data Science

Execute command denied to user ‘user’@’%’ for routine ‘sys.list_drop’

We see this error when mysql user doesn’t have permission to execute the list_drop Function inside sys schema of mysql. To fix this error we need to grant the privilege for the same. Login as the root user. Run the… Continue Reading →

Postgres basic commands

There are some basic postgres commands, those we use daily basis like listing database, switching database, listing tables etc. Listing Database \l # or \list 2. Switching Database \connect sales # or \c sales 3. Listing Tables \dt

Tuning Postgres on MacOS

If you are working on Postgres and facing issues of slow queries then tuning the Postgres server can be a good point to optimize the performance by tuning the Postgres database. In this article, we will talk about increasing the… Continue Reading →

Create a unique random Application ID in MySQL

Many times, we need to create a random application id with some specific format and that should be unique. In this example, we are going to create an application ID and that should follow the below conditions. It should be… Continue Reading →

Show process list in the Database and kill the process

Sometime, we need to check the list of processes running inside database or check the status of query. Various database provides their own way to check it. MySQL:If you are on MySQL database then run the below sql to check… Continue Reading →

Extract only digits from a string field in Postgres

If you want to only extract digits from a string in Postgres, we can do it using regexp_replace. \D tell not digit and ‘g’ stand for global. SELECT NULLIF(regexp_replace(‘OTHERdsfd4 323 2323d42324 3ssf3 432`sfd’, ‘\D’,”,’g’), ”)::numeric AS result — Output: 432323234232433432… Continue Reading →

Mysql column check if records which have other than a digit

Run the below SQL to check if your specified column have any other character other than digit. select * from database.table_name where column_name regexp ‘[^0-9]’;

Connect to Amazon Redshift using Mulesoft

In this tutorial, we are going to connect with amazon redshift with the help of Mulesoft’s Anypoint Studio. We will fetch the data from a table using a simple SQL query. Follow the step by step guide for the same…. Continue Reading →

Change the size of plot in matplotlib or seaborn python in Jupyter notebook

When you are working on the Jupyter notebook and using seaborn or matplotlib for plotting the curves, you will see that many times your plot is overlapping and you want to change the size of the plot. You can use… Continue Reading →

One hot encoding in python

If you are working in machine learning then I am sure you will need this code many times. Use the below piece of code for one hot encoding. cat_vars=[‘LeadSource’,’Products__c’,’Service_Offering__c’] for var in cat_vars: cat_list=’var’+’_’+var cat_list = pd.get_dummies(dataset2[var], prefix=var) dataset3=dataset3.join(cat_list) cat_vars=[‘LeadSource’,’Products__c’,’Service_Offering__c’]… Continue Reading →

« Older posts Newer posts »

© 2025 My Beliefs

Write us at [email protected]