Trending February 2024 # Basic Functions For Redis Keys To Access The Database # Suggested March 2024 # Top 10 Popular

You are reading the article Basic Functions For Redis Keys To Access The Database updated in February 2024 on the website Cattuongwedding.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested March 2024 Basic Functions For Redis Keys To Access The Database

Introduction to Redis Key

Redis is a standard key-value store like a dictionary that holds multiple keys and each has its unique value which can be retrieved or fixed. It is similar to a data structure server which depends on varied kinds of key values. It has different behavior like message broker, cache, and database works on multiple data structures and data types and has in-built replica features. It can hold keys to 512MB.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Key Takeaways

The keys stored in one index cannot be accessed in another index.

The option selected is used to navigate between the index and a total of 64 indexes in the implementation set-up.

Redis can also be used as a message broker, cache, and database.

The key supports multiple data structures and data types and holds the key till it has 512MB.

What is Redis Key?

Redis is a structured key-value store where it holds unique keys that can be fixed and retrieved. It enables the management and creation of multiple databases called indexes. The new association created are attached and defined with index 0 and they can also be changed and linked to another index also.

All Redis Keys Redis Key Insert and Retrieve

As Redis works as non-relational, all functions can be configured with standard key pairs at a basic level. It will be easy for data to recover if all the keys follow a specific pattern. Here via Redis CLI, the get and set commands are implemented accordingly.

OK

OK

The title and details are the keys that are set and the real string values were mentioned later. So the user can read them with the GET option.

“AWS”

“23 services”

By using a namespace, other relevant details can be added. A separator should be defined with a title and details as a unique numeric key.

OK

OK

OK

OK

By using GET, the user can fetch details using a numeric key.

“AWS”

“DevOps”

To retrieve all the existing keys, just give KEYS as a command.

All the existing keys are displayed. By using an asterisk, it is used as a wildcard search.

Redis Key Syntax

The simple syntax for Redis key pattern is:

KEYS pattern

OK

OK

“world”

OK

(nil)

An index doesn’t need to be created in order, but for a private index, the arbitrary number should be selected from 0 to 63.

Redis Key Commands

To associate to the endpoint of Redis and give an index apart from 0, then go with the –n flag along with the index integer. The cli of the Redis will specify if it is a non-zero index.

$ Redis-cli -h chúng tôi -n 17

Rivanna can access the open Redis service via the HPC network. The Redis service has secondary pair of servers in replica mode. One acts as primary to read and write. The endpoint is present in HPC networks and has no external access.

Using Rivanna, the Redis CLI command is executed as below:

$ load Redis-cli

Now the connection is established in port 6379 and it doesn’t require any password.

Redis Find and Delete

The syntax to search specific phrases or words within the key is given below:

It gives all the data present in name of “details” inside the key.

Redis cli – del “details”

Redis is a bit complicated when compared to other traditional databases as it is comprised of multiple columns and rows.

Examples

The common Redis keys and their data types are list, set, increments, hashes, random keys, command repetition, secondary index, values, and so on. Most of the essential examples are explained above.

FAQ

Given below are the FAQs mentioned:

Q1. How to use hash in Redis keys?

Answer: Hashes should be named, and their values and subkeys should be defined properly.

OK

To retrieve all values

1) “subkey1”

2) “subkey2”

Q2. How to name a key in Redis?

Answer: By standard naming function, the Redis namespace to keys can make the structure of the database organized. When the namespace has to use the keys by service or application, the: is used as a convention to delimit the naming parts.

Q3. Define keys.

Answer: Keys are similar to the library to track multiple strings. For any simple string or key value, Redis enables the user to get, set, delete, and other basic functions.

Conclusion

Hence these are the few basic functions for Redis keys where it is used to access the database in an effective method. It is user-friendly and can be executed as short-cut actions to manage the database.

Recommended Articles

This is a guide to Redis Key. Here we discuss the introduction, redis key insert and retrieve, syntax and examples. You may also have a look at the following articles to learn more –

You're reading Basic Functions For Redis Keys To Access The Database

Logitech Pop Keys Review: The Mechanical Keyboard For Emoji Addicts

Pros

Colorful and cute

Fast device switching

Easy emoji programming

Cons

Expensive

No rechargeable battery

Emojis only work on Windows and Mac

Our Verdict

The Pop Keys is an exercise in style over substance. While it has adorable looks and switches between devices easily, it’s asking a lot for rather cheap components.

Best Prices Today: Logitech Pop Keys Keyboard

At this point Logitech offers no fewer than 15 mechanical keyboards across its consumer and gaming divisions. So when I say that the Pop Keys is unique, that actually means something. You won’t find anything else quite like it from such a mainstream brand. The combination of mechanical practicality and fun style is something that should have broad appeal, or at least be more visually interesting than the usual gray-and-black rectangles.

And that’s the greatest strength of the Pop Keys—what we have here is a classic case of style over substance. While the board is perfectly adequate, in the same way that most of Logitech’s consumer-focused keyboards are, the corners cut on the design combined with its high price make it hard to recommend. Unless, of course, you just love that bubbly, curvy look with its dedicated emoji keys.

Further reading: See our roundup of the best wireless keyboards to learn about competing products.

The Logitech Pop Keys design

The most striking thing about the Pop Keys is its visual design. With perfectly rounded keycaps and a soft plastic body that looks like a big, squishy pillow, it has more curves than Mulhollond Drive. It’s also packing a column of five dedicated emoji keys along the left side, with four spare keycaps in case you want to switch them around. Our review unit came in a gray-on-white “Mist” color, but there are four other, far more vibrant options to choose from, including a wild combination of pastel yellow, purple, and green called “Daydream.”

Michael Crider/IDG

But don’t let the bubbly design fool you. Underneath those round keycaps are standard Cherry clone switches—brown ones, to be precise, for a slight tactile “bump” that’s pretty loud with all that plastic. The keyboard is also wireless, with Logitech’s standard combination of Bluetooth, RF (USB dongle in the box), and multi-device switching. The layout is the popular 75 percent size, as seen on such mechanical designs as the Keychron Q1, and the Logi Options+ software offers limited programmability. Legends that work for both Windows and Mac round out the feature set.

How does the Logitech Pop Keys cut costs?

At $100 retail, the Pop Keys is technically Logitech’s least expensive mechanical keyboard. It’s 50 bucks less expensive than the svelte MX Mechanical Mini, with the same number of keys, and $30 less than the gaming-focused G613. But spend a little time with the board, and you’ll see where Logitech is cutting a few corners for this consumer-focused board.

Michael Crider/IDG

First, the typing experience is, for lack of a more appropriate word, cheap. The shiny plastic keycaps are functional, and I got used to their circular shape after only a day or so. But the plastic is slippery, the legends are painted on (and will wear out much faster than doubleshot keycaps), and the switches are just about the cheapest you can find. Every keystroke on this board will rattle far more than even a basic mechanical board with a less splashy design. I wouldn’t recommend it for a crowded office. Sure, you could swap out the funky keycaps, because the TTC switches use the standard cross stem. But then what’s the point of buying this board?

Elsewhere, the keyboard is lacking illumination except for the Caps Lock and device indicators, and it offers neither a rechargeable battery or a USB port backup—I hope you’ve got a few AAAs for when this thing dies. Lastly, while I actually like the smooth, rounded body and the stylish little bar on the back, there are no deployable feet, so you’ll have to make do with the board’s single rather shallow typing angle.

No hinged keyboard feet means the Pop Keys offers only one typing angle.

Michael Crider/IDG

True, Logitech is hardly aiming for the keyboard purist with this design. But even so, omitting such basic features as deployable feet is something I just can’t overlook on a $100 board.

mentioned in this article

MX Mechanical Mini

Read our review

Best Prices Today:

What does the Logitech Pop Keys do?

Which brings us to the signature functional feature of the Pop Keys, the ability to quickly input emoji. To its credit, the keyboard is very good at this. You can put in any emoji you want, so long as it’s supported by Windows or MacOS, and change them out easily enough via the Logi Options+ programming tool. You’re not limited to just the emoji included on the board or its spare keycaps, either, though you’ll need to remember which ones you chose if you stray from the printed designs.

Michael Crider/IDG

For those who prefer their keyboards a little more functional, you can also program the five emoji keys (as well as F4 through F12 and the dedicated Mic key) using the Options+ tool. This allowed me to set up my preferred 75 percent layout, with dedicated volume, start/pause, and screenshot keys on the main layer. It’s surprisingly flexible!

Logitech’s device-swapping feature is also handled well, as I’ve come to expect from the company’s wireless designs. Switching between my Windows desktop, iPad, and Android phone was near-instant with the F1 to F3 keys. However, custom emoji programming didn’t carry over to the mobile devices. So if you want that effortless emoji input specifically for non-desktop or laptop hardware, you’ll be a bit disappointed.

Michael Crider/IDG

I also have to point out that other Logitech keyboards that can be programmed with Logi Options+, like the MX Mechanical Mini, can also set specific keys to input emoji. But of course, those more buttoned-down boards lack the fanciful emoji keycaps.

A better value alternative

Keychron K3 Pro

Read our review

Best Prices Today:

Is the Logitech Pop Keys worth it?

Michael Crider/IDG

In terms of value, I’d steer someone toward the Keychron K3 Pro for roughly the same price, with much better components, features, and programmability. Or heck, just save some money and go with one of Logitech’s non-mechanical offerings, like the similarly whimsical K480. You could also just get a set of “retro” keycaps and throw them on any cheap mechanical board of your choosing.

Michael Crider/IDG

But I’m not made of stone. The Pop Keys is freakin’ adorable, for all its cheap components, and it does deliver on its promise of effortless emoji input (at least on Mac and Windows). If that’s what you’re looking for, it might be worth the splurge…or perhaps better yet, might be worth waiting on a sale. The $79.99 it’s going for on Amazon at the time of writing (for some colors) seems a little more appropriate.

Rescue Your Database With Recovery Toolbox For Mysql

This is a sponsored article and was made possible by Recovery Toolbox. The actual contents and opinions are the sole views of the author who maintains editorial independence, even when a post is sponsored.

Ask anyone who uses databases, and they’ll be quick to tell you that databases are complicated things. Even what appears to be a relatively simple database on the surface can be quite complex underneath. They can also be quite tough to fix when something goes wrong.

There’s a reason most software that relies heavily on databases frequently backs that data. It’s much simpler to restore a functioning database than to try to fix a damaged or corrupted one. In the case of the latter, Recovery Toolbox for MySQL could make your life much easier.

System Requirements

There aren’t any hardware requirements listed for Recovery Toolbox for MySQL, and software requirements are slim. The software is Windows-only but supports most versions. Windows 98, ME, 2000, XP, Vista, 7, 8, and 10 are all supported. For server versions, Windows Server 2003, 2008, 2012, and 2024 are supported.

In many cases you won’t necessarily have database software running on your own computer. Instead, the database is located on a server or other computer. Fortunately, Recovery Toolbox for MySQL doesn’t rely on any other software. This means nothing is going to get in the way of recovering your data.

Features

MySQL databases can use different storage engines, which could make recovery tricky if your software only supports one. Recovery Toolbox for MySQL can recover both MyISAM and InnoDB formats, meaning you’re covered no matter what.

This flexibility is present when it comes to saving your recovered data as well. You can export recovered data as an SQL script or export data directly into an existing MySQL server database. You can also save data selectively, so if you only need some key information out of a corrupted database, you don’t have to save the entire thing.

Recovery Toolbox for MySQL can recover tables, indexes, primary keys, foreign keys, and even views. It also supports Unicode data for recovery. After initial recovery, you can preview recovered tables, complete with their content. You can also preview recovered SQL structures.

Performance

Unless you’re a data recovery specialist, most people don’t happen to have damaged or corrupted databases on hand. Because of this, the people at Recovery Toolbox supplied us with several examples of databases to test the software. In our tests, recovery was always relatively quick, though obviously this will vary greatly with different hardware.

The preview features are very handy. In fact, the preview function may be one of the key selling points of this software. This is especially true since there is no online recovery option, which is usually available for many of Recovery Toolbox’s other software tools.

Using Recovery Toolbox for MySQL

To get started with Recovery Toolbox for MySQL, download and run the installer. Let it complete installation, and the app will automatically launch for the first time. You can choose to register a license for the app now or can do that part later.

This software, like other software from this developer, is presented in the form of a “wizard.” This walks you through the recovery. Start by choosing the directory that contains database files to load, then the wizard will auto-discover the database names. Pick the database to load, then choose a name for the new database in which recovered data will be saved.

Depending on how large the database is and how powerful your computer is, recovery time will vary. It may take a few seconds or a few minutes. It could even take several minutes. Once initial recovery is finished, you can preview the recovered data.

The preview stage is also where you can choose which data you want to save, assuming you don’t want to save it all. Once you’ve had a chance to look everything over, you can save the recovered data.

Pricing

There are a few different options for buying Recovery Toolbox for MySQL, but the feature set is the same for all of them. The difference is whether you’re buying for personal or business use. To start, a single Personal license costs $27.

A Business license, either for use by companies, governments, or individuals using the software for commercial purposes, costs $45. Finally, a site license costs $60, which allows installation on up to 100 different devices. This can be in one building or divided across multiple locations.

Conclusion

As with many of the software tools from this developer, this isn’t a software Swiss Army knife. Recovery Toolbox for MySQL is a specialized tool meant for a very specific task. When you need this software to do its job, it does it well. That alone should be information enough for you to tell whether this software is a good choice for you.

Unlike many other tools from Recovery Toolbox, there is no online version of this software. If you want to recover a database, you’ll need to buy the software. Fortunately, you can try Recovery Toolbox for MySQL for free. This will let you try recovering your database and even let you preview the recovered data. To save the recovered data, you can purchase a license.

Kris Wouk

Kris Wouk is a writer, musician, and whatever it’s called when someone makes videos for the web.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.

By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.

Learn The Basic Concepts Of Security Engineering

Introduction to Security engineering

Security Engineering focuses on the security aspects in the development of the systems so that they can deal robustly with losses caused by accidents ranging from natural disasters to malicious attacks. The main motto of security Engineering is to not only satisfy pre-defined functional and user requirements but also preventing the misuse of the system and malicious behavior. Security is one of the quality factors of a system that signifies the ability of the system to protect itself from accidental and malicious external attacks. It is an important issue as networking of the system has increased, and external attacks to the system through the internet can be possible. Security factor makes the system available, safe, and reliable. If a system is a networked System, then the reliability and its safety factors become more unreliable.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Why do we need security Engineering? Security risk management

Vulnerability avoidance: The system is designed so that vulnerabilities do not occur. Say if there is no network, then the external attack is not possible.

Detection and removal of attacks: The System is designed so that attacks can be detected and removed before they result in any exposure of data programs s same as the virus checkers who detect and remove the viruses before they infect the system.

Damage caused due to insecurity.

Corruption of programs and data: The programs or data in the system may be modified by unauthorized users.

Unavailability bod service: The system is affected and out into a state where normal services are not available.

Leakage of confidential information: Information that is controlled by the system may be disclosed to the people who are not authorized to read or use that information.

System survivability

System survivability is nothing but an ability of a system to continue performing difficult functions on time even if a few portions of the system are infected by malicious attacks or accidents. System survivability includes elements such an s reliability, dependability, fault tolerance, verification, testing, and information system security. Let’s discuss some of these elements.

Adaptability: even if the system is attacked by a threat, the system should have the capability to adapt to the threat and continue providing service to the user. Also, the network performance should not be degraded by the end-user.

Availability: The degree to which software remains operable in the presence of system failures.

Time: Services should be provided to the user within the time expected by the user.

Connectivity: It is the degree to which a system performs when all nodes and links are available.

Correctness: It is the degree to which all Software functions are specified without any misunderstanding and misinterpretations.

Software dependence: The degree to which hardware does not depend upon the software environment.

Hardware dependence: The degree to which software does not depend upon hardware environments.

Fault tolerance: The degree to which the software will continue to work without a system failure that would cause damage to the user and the degree to which software includes recovery functions

Fairness: It is the ability of the network system to organize and route the information without any failure.

Interoperability: It is the degree to which software can be connected easily with other systems and operated.

Performance: It is concerned with the quality factors kike efficiency, integrity, reliability, and usability. Sub factors include speed and throughput.

Predictability: It is the degree to which a system can provide countermeasures to the system failures in the situation of threats.

Modifiability: It is the degree of effort required to make modifications to improve the efficiency of functions of the software.

Safety: It is the ability of the system to not cause any harm to the network system or personnel system.

Recoverability: It is the ability of the system to recover from an accident and provide normal service on time.

Verifiability: It is about the efforts required to verify the specified Software functions and corresponding performance.

Security: it is the degree to which the software can detect and prevent the information leak, loss of information, and malicious use, and then any type of destruction.

Testability: It is about the efforts required to test the software.

Reusability: It is the degree to which the software can be reused in other applications.

Restorability: It is the degree to which a system can restore its services on time.

Recommended Articles

This is a guide to Security engineering. Here we have discussed the basic concepts of security Engineering and its various terms used for system protection. You may also have a look at the following articles to learn more –

How To Rebuild Mac Outlook 2024 Database? – Solutions To Fix The Error

Users want to know the answer and solutions to the query: How to Rebuild Mac Outlook 2024 Database? When it comes to email clients, we have seen the Outlook is the most used and preferred email client. Outlook manages emails, contacts, calendar, tasks, etc from users’ data and is also available for both Windows and Mac. There is not much difference between Mac Outlook 2024 and Mac Outlook 2011. The basic difference is the Mac Outlook 2024 comes with integration to OneDrive.

MS Outlook 2024 Mac has improved its performance factor but there may come situations where users have to look for Mac Outlook 2024 rebuild database utility. Now Outlook can be used to rebuild the database automatically if there is a case of data corruption. Let’s check out the solutions for the repairing and rebuilding of Mac Outlook 2024 database.

Solutions for How to Rebuild Mac Outlook 2024 Database

The manual method provided in Outlook 2024 can be used to manage the profiles. It is the manage profiles utility that helps users rebuild the database. There is another solution which can be used and is the best solution to be used. Both the solutions are mentioned below.

What is the Best Mac Outlook 2024 Rebuild Database Utility?

Also read: Top 10 Job Search Websites of 2023

Steps to Rebuild Mac Outlook 2024 Database

Step 1 – Launch the tool and select the radio button adjacent to “Auto-Locate Mac Outlook 2023/2024/Office 365 profiles”.

Step 3 – Now, choose the “Export Type” as PST and mark the “Maintain Folder Hierarchy” check box to keep the structure same.

Note: Apply the filters provided by the tool from the “Advanced Settings” as the users require.

Learn How to Rebuild Mac Outlook 2024 Database

Follow the steps given below using Outlook profile manager:

Stage 1 – First Access Outlook Manager

Here, you will find the “Control” option. Choose this option to move further.

After that, open Outlook Profile Manager and use it.

Now, you have to create a profile in this Mac Outlook 2024 Rebuild Database Utility.

Stage 2 – Create a New Profile

In the text box, enter a name for the new profile.

Hit “Return” and create a new profile.

Stage 3 – Delete Existing Profile

After deleting the existing profile, users have to go through just one more stage for learning how to rebuild Mac Outlook 2024 database.

Stage 4 – Default Profile setting

Open the Outlook Profile Manager. Here, you need to set a default profile. To do so, you have to select the option “Profile to set as Default”.

Hit the “Gear” button and select “Set as Default” option.

Also read: Top 7 Best ECommerce Tools for Online Business

Reasons to Rebuild Mac Outlook 2024 Database

Users should rebuild their database in Mac Outlook 2024 for the following reasons:

Mac becomes very slow and unresponsive

Users can not find or locate the OLM data file

Emails are not accessible and an error message saying “Access denied” pops-up

Mac System is terminated suddenly or after a fixed duration

Outlook in Mac crashes again and again without warning

Error messages are displayed on the screen with the description and a probable solution

Last Line

There could be any reason for users to search for solutions to rebuild Mac Outlook 2024 database. The reasons have been mentioned above and the respective solutions are given as well. Since, Outlook 2024 provides integration with OneDrive, it is only a little different from Outlook 2011. Here, users can choose the method they want to use based on the amount of time they’d like to spend. For the third-party tool, only a few minutes are required, and for the manual Mac Outlook 2024 rebuild database utility, a lot of time is required.

Lindsey Smith

Lindsey loves to share his technology knowledge with write blog and article. Besides this, She is fond of reading books, writing short stories, EDM music and football lover.

Introduction To Supabase: Postgres Database Using Python

This article was published as a part of the Data Science Blogathon.

Introduction

Supabase is an open-source Backend as a Service (BaaS) that is gaining traction among developers in recent times. Supabase claims to be the open-source Firebase alternative and is backed by big tech companies like Yandex, Mozilla, and Coatue. Just like Google Firebase, Supabase also aims to replace the complete backend for modern web and mobile applications by providing various important features and functionalities like authentication, cloud storage, database, analytics, and edge functions. These services can automatically scale by network traffic without any manual setup.

The major issue with Google Firebase is vendor lock-in, which is one reason companies refrain from using these platforms to reduce development time. In the case of Supabase, there is no fear of vendor lock-in. Another significant difference between Supabase and Firebase is that Supabase is built on top of a Postgres database while Firebase ships a NoSQL database called Firestore. If you are interested in learning about the Firestore database offered by Google Firebase, refer to my previous article here.

In this article, we will learn how to set up the Postgres database on the Supabase platform and perform basic CRUD operations using the python programming language. We will also see some SQL queries to perform some CRUD operations on the Postgres database.

Setting-up Supabase

Navigate to the official Supabase website and sign in with your GitHub account to access Supabase. This is a mandatory step.

Once you sign in with your Github account, you can see all your projects on the dashboard. Please note that the free-tier version lets you create a maximum of up to 2 projects. Let’s go ahead and create a new Supabase project.

Now that we have created a table let’s get our hands dirty and shift our focus to the programming part.

Connecting to Supabase and Performing CRUD Operations

There is a Supabase client for python available that can be installed like any other python module using pip. Let’s go ahead and install it before proceeding further.

$ pip install supabase

Two things are mandatory to connect to the Supabase database: the Project URL and the API Key. To extract this, navigate to the settings tab and select the API section, where you will find the project URL and the API key. Copy the URL, and the anon public key as this will be used to connect to the Supabase database.

Now that we have all the credentials with us let’s go ahead and connect to the Supabase database.

from supabase import create_client import json API_URL = 'your_url' API_KEY = 'your_key' supabase = create_client(API_URL, API_KEY) supabase

Now that we have successfully connected to our database let’s understand how to perform basic CRUD operations.

Let us first see how we can insert a single record into a table in our database. Each record needs to be a dictionary containing all the information. To insert a record into a table, we use the “insert()” function, which accepts the record data as a dictionary.

data = { 'id': 1, 'name': 'Vishnu', 'age': 22, 'country': 'India', 'programming_languages': json.dumps(['C++', 'python', 'Rust']) } supabase.table('demo-database').insert(data).execute() # inserting one record APIResponse(data=[{'id': 1, 'created_at': '2024-07-17T08:58:24.105377+00:00', 'name': 'Vishnu', 'age': 22, 'country': 'India', 'programming_languages': '["C++", "python", "Rust"]'}], count=None)

Now the same “insert()” function can also be used to insert multiple records. To do so, we must pass in a list of dictionaries containing all the records’ data. Let’s see this in action now.

data = [ { 'id': 2, 'name': 'Prakash', 'age': 37, 'country': 'India', 'programming_languages': json.dumps(['C#', 'web assembly']) }, { 'id': 3, 'name': 'Arjun', 'age': 29, 'country': 'Germany', 'programming_languages': json.dumps(['python', 'nodejs', 'Rust']) }, { 'id': 4, 'name': 'Sanjay', 'age': 19, 'country': 'India', 'programming_languages': json.dumps(['python']) }, { 'id': 5, 'name': 'Ram', 'age': 44, 'country': 'India', 'programming_languages': json.dumps(['python', 'Go']) } ] supabase.table('demo-database').insert(data).execute() # inserting multiple records APIResponse(data=[{'id': 2, 'created_at': '2024-07-17T09:02:48.193326+00:00', 'name': 'Prakash', 'age': 37, 'country': 'India', 'programming_languages': '["C#", "web assembly"]'}, {'id': 3, 'created_at': '2024-07-17T09:02:48.193326+00:00', 'name': 'Arjun', 'age': 29, 'country': 'Germany', 'programming_languages': '["python", "nodejs", "Rust"]'}, {'id': 4, 'created_at': '2024-07-17T09:02:48.193326+00:00', 'name': 'Sanjay', 'age': 19, 'country': 'India', 'programming_languages': '["python"]'}, {'id': 5, 'created_at': '2024-07-17T09:02:48.193326+00:00', 'name': 'Ram', 'age': 44, 'country': 'India', 'programming_languages': '["python", "Go"]'}], count=None)

We can see that all the records are also visible in our dashboard. Now that we have understood how to perform the insertion operation, let’s see how we can fetch some documents from the table.

To fetch some records from the table, we can use the “select()” function just like the select SQL query. Let’s see this in action to have a better understanding.

supabase.table('demo-database').select('*').execute().data # fetching documents [{'id': 1, 'created_at': '2024-07-17T08:58:24.105377+00:00', 'name': 'Vishnu', 'age': 22, 'country': 'India', 'programming_languages': '["C++", "python", "Rust"]'}, {'id': 2, 'created_at': '2024-07-17T09:02:48.193326+00:00', 'name': 'Prakash', 'age': 37, 'country': 'India', 'programming_languages': '["C#", "web assembly"]'}, {'id': 3, 'created_at': '2024-07-17T09:02:48.193326+00:00', 'name': 'Arjun', 'age': 29, 'country': 'Germany', 'programming_languages': '["python", "nodejs", "Rust"]'}, {'id': 4, 'created_at': '2024-07-17T09:02:48.193326+00:00', 'name': 'Sanjay', 'age': 19, 'country': 'India', 'programming_languages': '["python"]'}, {'id': 5, 'created_at': '2024-07-17T09:02:48.193326+00:00', 'name': 'Ram', 'age': 44, 'country': 'India', 'programming_languages': '["python", "Go"]'}]

The “*” represents that we need all the columns to be returned from the table. This can be done using the SQL editor from our dashboard as well. Let’s go ahead and write a simple SQL query and see how it works.

We can see that we get the same response here as well. Now select queries are pretty dumb if we do not have any sort of filtering. You can understand this part easily if you are slightly familiar with MongoDB queries. Now let’s see a couple of filtering techniques in action.

Let’s try to fetch all the records where the age exceeds 35 years. To execute this, we can make use of filtering techniques. In this case, we will be using the “gt()” function, which stands for the “greater than” operator. Let’s solve this by running a normal SQL query as well in the SQL editor.

supabase.table('demo-database').select('*').gt('age', 35).execute().data # fetching documents with filtering [{'id': 2, 'created_at': '2024-07-17T09:02:48.193326+00:00', 'name': 'Prakash', 'age': 37, 'country': 'India', 'programming_languages': '["C#", "web assembly"]'}, {'id': 5, 'created_at': '2024-07-17T09:02:48.193326+00:00', 'name': 'Ram', 'age': 44, 'country': 'India', 'programming_languages': '["python", "Go"]'}]

We can see that the SQL query also returns the same set of records as the response. Now we can add multiple sets of filters as well. To see this in action, let’s try to fetch all the records with ages greater than 35 but less than 40.

supabase.table('demo-database').select('*').gt('age', 35).lt('age', 40).execute().data # multiple filtering [{'id': 2, 'created_at': '2024-07-17T09:02:48.193326+00:00', 'name': 'Prakash', 'age': 37, 'country': 'India', 'programming_languages': '["C#", "web assembly"]'}]

Now that we have seen how records can be fetched from the table let’s look at how we can update records in the table. For this, we make use of the “update()” function. Let’s try to update the country to France for the record having id as 2. We make use of the “eq()” function that serves as the “equal to” operator for filtering. If we do not include this, all the records in the table will be updated.

supabase.table('demo-database').update({"country": "France"}).eq("id", 2).execute() # updating a record APIResponse(data=[{'id': 2, 'created_at': '2024-07-17T09:02:48.193326+00:00', 'name': 'Prakash', 'age': 37, 'country': 'France', 'programming_languages': '["C#", "web assembly"]'}], count=None)

We can see that the country has been successfully updated to France.

Now let’s look at the last operation, which is the delete operation. To delete a record, we use the “delete()” operation along with some filtering operations lest all the records in the table will be deleted. This is similar to the update operation explained in the previous section. Let’s go ahead and delete a record from the table. We will delete the record having id as 1.

supabase.table("demo-database").delete().eq("id", 1).execute() # deleting a record APIResponse(data=[{'id': 1, 'created_at': '2024-07-17T08:58:24.105377+00:00', 'name': 'Vishnu', 'age': 22, 'country': 'India', 'programming_languages': '["C++", "python", "Rust"]'}], count=None)

We can see that the corresponding record has been deleted successfully.

Conclusion

A few key takeaways:

Understanding how to set up a Postgres database in Supabase

Learning how to perform basic CRUD operations on the Postgres database using python

Learning how to use the SQL editor to write SQL queries

As mentioned earlier, Supabase provides many other services like authentication, cloud storage, real-time database, and edge functions. The real-time database feature is currently not available for python. I will try to cover the cloud storage service provided by Supabase in another article in the coming weeks, so stay tuned!

That’s it for this article. I hope you enjoyed reading this article and learned something new. Thanks for reading and happy learning!

The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion.

Related

Update the detailed information about Basic Functions For Redis Keys To Access The Database on the Cattuongwedding.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!