Welcome to Ed2Ti Blog.

My journey on IT is here.

RESTful API vs GraphQL

- Posted in Trebas College by

When it comes to building modern web applications, there are two popular approaches for designing and consuming APIs: RESTful APIs and GraphQL. Both have their advantages and disadvantages, and it's important to understand the differences between the two before deciding which one to use.

REST (Representational State Transfer) is a set of guidelines for building web services that use HTTP methods such as GET, POST, PUT, and DELETE to manipulate resources. RESTful APIs are designed around resources and their representations, and they typically use JSON or XML to transfer data between the client and server.

GraphQL, on the other hand, is a query language for APIs that was developed by Facebook. It allows clients to request specific data from the server using a single endpoint, and the server responds with only the requested data. GraphQL uses a type system to define the data that can be queried, and it supports real-time updates and subscriptions.

So, which approach is better? Let's take a closer look at the pros and cons of each.

RESTful APIs

Pros:

Widely adopted: RESTful APIs are a well-established standard and are used by many companies, including Twitter, Google, and Amazon. Caching: Because RESTful APIs use HTTP caching, they can improve performance by reducing the number of requests to the server. Simplicity: RESTful APIs are simple and easy to understand. They use HTTP methods and URLs to manipulate resources, which makes them easy to work with.

Cons:

Overfetching and underfetching: Because RESTful APIs return the entire resource by default, clients may end up receiving more data than they need (overfetching). On the other hand, if a client needs data from multiple resources, it may need to make multiple requests to retrieve all the necessary data (underfetching). Versioning: If the API changes, clients may need to be updated to work with the new version. This can be challenging if the API has a large number of clients. Complexity with hierarchical data: If the data is hierarchical, such as a tree structure, clients may need to make multiple requests to retrieve all the necessary data.

GraphQL

Pros:

Flexibility: Because clients can request only the data they need, GraphQL can reduce the amount of data transferred over the network, resulting in improved performance. Strongly typed: GraphQL's type system makes it easy to understand the structure of the data being queried and reduces the risk of errors. Real-time updates: GraphQL supports real-time updates and subscriptions, which makes it ideal for building real-time applications.

Cons:

Learning curve: Because GraphQL is a new technology, it may take some time to learn and understand. Caching: Because GraphQL queries can be very specific, caching can be more difficult to implement than with RESTful APIs. Server complexity: Because the server needs to process and validate queries, it can be more complex to implement than a RESTful API.

Conclusion

Both RESTful APIs and GraphQL have their advantages and disadvantages, and the choice between them will depend on the specific requirements of the project. RESTful APIs are a well-established standard and are simple to work with, but they can be limited in terms of flexibility and performance. GraphQL, on the other hand, offers greater flexibility and can improve performance by reducing the amount of data transferred over the network, but it requires more effort to implement and may not be suitable for all use cases.

Ultimately, the choice between RESTful APIs and GraphQL will depend on factors such as the size and complexity of the application, the types of data being queried, and the performance requirements of the project.

College: Trebas Institute
Professor: Iyad Koteich

It's impressive how fast and easy you can start your won API solution using Flask and Python.

In this post, I want to share with you my experience using tools and concepts to create a simple API solution.

Tools:

  • Phyton (https://www.python.org/)
  • Flask (https://flask.palletsprojects.com/en/2.2.x/)
  • SQLite (https://www.sqlite.org/)
  • Postman (https://web.postman.co/)

In this restful API I'm using the verbs:
* POST - To insert information into a database
* GET - To recover information from a database.
* PUT (I'm not using) - To update information into a database.
* DELETE (I'm not using) - To delete information from a database.

The next objective is to create a full CRUD API.
All the codes are here on my Git repository: https://github.com/ed2ti/python_flask_db

Microsoft Azure - AZ900

- Posted in Cloud - Azure - Journey by

An important point when you start your journey on the Microsoft Azure platform is to understand what services they dispose of to us and how can we choose these services to attend to our budget and business.

In fact, for AZ 900 test, we need to study these concepts:

Cloud Models
Cloud Benefits
Azure Cloud Services
Core Azure Archteture
Core Azure Workloads
Azure Solutions
Azure Management Tools
Security tools and features
Core Azure identity services
Azure Governance Methodologies
Privacy, compliance, and data protection standards
Planning and Cost Management
Azure SLAs and service lifecycles

Every day, I'll write about one or two concepts here.

enter image description here

DevOps - Changing your mindset.

- Posted in Uncategorized by

Today I'll try to discuss in a few words some important concepts about DevOps. The first is that DevOps is a concept that results in a paradigm change.

Starting as DevOps we need to understand the difference between Greenfield and Brownfield. In a simple view, Greenfield is untouched land, and a Brownfield is the used ground for other purposes. Now you are confused, but don't worry.

Greenfield => New Brownfield => Legacy

But, how about using a bimodal model? For example, we can see in some organizations two or more kinds of systems. We can categorize them as Record and Engagement Systems.

The Record Systems are more stable and generally don't have frequent updates. Engagement Systems generally are created to support pieces of information that come from Record Systems. Then, an issue with this Engagement System could impact Record Systems.

First, we need to understand some initial concepts and a little history of developing and managing the environments.

In past, ware common we listen to the history of some projects that fail because of the integrations between the Developer and Operation teams.

Today I don't want to compare MariaDB(Mysql) with PostgreSQL. I just want to share with you some ways to fastly start these databases as a Service for free.

** Just remember that MariaDB is not the same as Mysql. MariaDB is a community fork from Mysql.

I am talking about a study or test proposal.

The ElephantSql, the name refers to an animal that represents PostgreSql, and you can do your register at https://www.elephantsql.com/

The Skysql, you will receive 500$ to spend with your MariaDB databases. To register an account you can just click on the link https://mariadb.com/products/skysql/get-started/ [Remember to stop the service after you use]

But you can ask me: what is your proposal with this share?

Between 2022-10-31 and 2022-11-04, professor Iyad Koteich asks me to present some examples of using ETL with Pentaho(PDI). We will do an ETL process with Python, and then, we will do the same with Pentaho(PDI).

The main purpose is that you can understand the ETL pipeline at Pentaho.

All the files and requirements will be here, and you can download them on GitHub (https://github.com/ed2ti/Pentaho_Data_Integration)

Thank you Professor Iyad Koteich for this new challenger.

Today I was reading and organizing some files from my computer and I found my first article from Trebas.

It was interesting because after reading again this file I found a lot of necessary modifications and corrections. Of course, I can't do that on the original document, but I'm planning to do another with a similar title.

If you can read It, I'll really appreciate your feedback by mail. Thank you!

Professor: Ghazal G.Fard
College: Trebas Institute

Link to download https://github.com/ed2ti/articles/blob/main/trebas_assignment_2_english.pdf

Python & Pandas & SQLite

- Posted in Trebas College by

As requested by Professor Iyad Koteich, now the application saves the data on the SQLite database.

In the first post (here) we did a python program to join three spreadsheets in just one. This work involves knowledge of pandas to organize the data.

Now we create a database and a table to store all data. This version is so simple and does not check the user store option.

I'll create a new project on GitHub because I'll show how to merge these steps in one project. (god to understand git commands line)

GitHub: https://github.com/ed2ti/exercise04

[CODE]

# *************************** #
# College: Trebas Institute 
# Professor: Iyad Koteich
# Class: Edward
# Day: 2022-10-13
# *************************** #

#Importing Libres
## Pandas ##
import pandas as pd
from pandas import DataFrame 

## sqlite3 ##
import sqlite3
from sqlite3 import Error

###
### INFORMATIONS FROM Concordia ###
###

##Loading Data
concordia = pd.read_excel('Concordia.xlsx')

## Informing that this informations are form Concordia
concordia["College"] = 'Concordia'

#show Concordia Result
print(concordia.head())
print('n')

###
### INFORMATIONS FROM McGill ###
###

##Loading Data
mcgill    = pd.read_excel('McGill.xlsx')

## Informing that this informations are form McGill
mcgill["College"] = 'McGill'

## Organizing the DataFrame
mcgill.rename(columns={'id': 'Student_Code'}, inplace = True)
mcgill.rename(columns={'name': 'Full_Name'}, inplace = True)
mcgill.rename(columns={'Course': 'Program'}, inplace = True)
mcgill.rename(columns={'country': 'Nationality'}, inplace = True)
mcgill.drop(columns=['city'], inplace = True)

#show McGill Result
print(mcgill.head())
print('n')

###
### INFORMATIONS FROM Trebas ###
###

##Loading Data And Print The Colums
trebas    = pd.read_excel('TREBAS.xlsx')

## Informing that this informations are form TREBAS
trebas["College"] = 'TREBAS'

## Organizing the DataFrame
trebas.rename(columns={'Country': 'Nationality'}, inplace = True)
trebas.rename(columns={'Student_ID': 'Student_Code'}, inplace = True)
trebas["Full_Name"] = trebas["First_Name"] + " " + trebas["Last_Name"]
trebas.drop(columns=['City'], inplace = True)
trebas.drop(columns=['First_Name'], inplace = True)
trebas.drop(columns=['Last_Name'], inplace = True)

#Ajusting the sequence of the columns
trebas = trebas[["Student_Code","Full_Name","Nationality","Program", "College"]]

#show Trebas Result
print(trebas.head())
print('n')

final = pd.concat([trebas, concordia,mcgill], ignore_index=True, sort=False)
print(final)


# Exporting to excel (to_excel)
final.to_excel ('final.xlsx', index = True, header=True)


## 
## Try to conect database (memory)
## This database is on the Memory (no file) for a best performance.
## If you want, you can change :memory: for a name file.
##

#target = ':memory:';
target = 'ex-04.db';

conn = None;
try:
    conn    = sqlite3.connect(target)
    print("connect on Database sqlite3 "+sqlite3.version)
    cur     = conn.cursor()
except Error as e:
    print(e)

# Create a final table (IF NOT EXISTS)#
## id = AUTOINCREMENT ##
cur.execute("CREATE TABLE IF NOT EXISTS final(id INTEGER PRIMARY KEY AUTOINCREMENT, Student_Code TEXT, Full_Name TEXT, Nationality TEXT, Program TEXT, College TEXT)")

## Trucate the final table ##
cur.execute("DELETE FROM final")

#
data = final.values

#print(len(data))

for i in range(len(data)):
    #datal = Data Line 
    datal = data[i]
    # writing on Database
    cur.execute("INSERT INTO final(Student_Code, Full_Name, Nationality, Program, College) VALUES (?,?,?,?,?)", datal)
    conn.commit()
conn.close()

A new challenge from Professor Iyad Koteich with Python and Pandas

The objective consists of organizing and joining (merge) three spreadsheets from Colleges in Montreal. All three spreadsheets are different and some work is necessary to normalize them.

  1. Define the base columns. (Best option is the Concordia spreadsheet.
  2. Insert College column.
  3. Rename the names of the DataFrame columns (if necessary)
  4. Delete some DataFrame columns (if necessary)
  5. Organize DataFrame columns from trebas
  6. Save the fina DataFrame on an xlsx file.

After that, just put your hands on it.

GitHub -> https://github.com/ed2ti/exercise03

[The Python CoDe]

# *************************** #
# College: Trebas Institute 
# Professor: Iyad Koteich
# Class: Edward
# Day: 2022-10-05
# *************************** #

#Importing Libres
import pandas as pd
from pandas import DataFrame 

###
### INFORMATIONS FROM Concordia ###
###

##Loading Data
concordia = pd.read_excel('Concordia.xlsx')

## Informing that this informations are form Concordia
concordia["College"] = 'Concordia'

#show Concordia Result
print(concordia.head())
print('n')

###
### INFORMATIONS FROM McGill ###
###

##Loading Data
mcgill    = pd.read_excel('McGill.xlsx')

## Informing that this informations are form McGill
mcgill["College"] = 'McGill'

## Organizing the DataFrame
mcgill.rename(columns={'id': 'Student_Code'}, inplace = True)
mcgill.rename(columns={'name': 'Full_Name'}, inplace = True)
mcgill.rename(columns={'Course': 'Program'}, inplace = True)
mcgill.rename(columns={'country': 'Nationality'}, inplace = True)
mcgill.drop(columns=['city'], inplace = True)

#show McGill Result
print(mcgill.head())
print('n')

###
### INFORMATIONS FROM Trebas ###
###

##Loading Data And Print The Colums
trebas    = pd.read_excel('TREBAS.xlsx')

## Informing that this informations are form TREBAS
trebas["College"] = 'TREBAS'

## Organizing the DataFrame
trebas.rename(columns={'Country': 'Nationality'}, inplace = True)
trebas.rename(columns={'Student_ID': 'Student_Code'}, inplace = True)
trebas["Full_Name"] = trebas["First_Name"] + " " + trebas["Last_Name"]
trebas.drop(columns=['City'], inplace = True)
trebas.drop(columns=['First_Name'], inplace = True)
trebas.drop(columns=['Last_Name'], inplace = True)

#Ajusting the sequence of the columns
trebas = trebas[["Student_Code","Full_Name","Nationality","Program", "College"]]

#show Trebas Result
print(trebas.head())
print('n')

final = pd.concat([trebas, concordia,mcgill], ignore_index=True, sort=False)
print(final)


# Exporting to excel (to_excel)
final.to_excel ('final.xlsx', index = True, header=True)

Today we did a program in Python just to convert celsius to Fahrenheit

# ********* #
# College : Trebas Institute 
# Professor: Iyad Koteich
# Class : Edward
# Day: 03/10/2022
# ********* #

def convert(gc):
    gf = (gc*9/5)+32
    return gf

def good(gf):
    if (gf>60 and gf<90):
        print(f"{gf} fahrenheit is a good Wealth")
    else:
        print(f"{gf} fahrenheit is not Good Wealth")

def trebas():
    print("College : Trebas Institute") 
    print("Professor: Iyad Koteich")
    print("Class : Edward")
    print("Day: 03/10/2022")
    print("")

trebas()

optoin = '' 
while optoin != '0':
    option = int(input("Value in celcus: "))
    if option != 0:
        gf = convert (option)
        good(gf)
    else:
        print("Exiting")
        break

The principles of Data Warehouse.

- Posted in Trebas College by

This week, Mr. Iyad Koteich, my professor at Trebas Institute, gave me an opportunity to share my knowledge about Data Warehouses.

It was perfect because I could remember some concepts and share them with my classmates. Of course, to talk about business intelligence, data warehouse, and SGBD we need to

Initial Concepts.

Model ER - Or Entity–relationship model. Before we start to develop a solution, is important to have the base requirements of the system to model the first structure of the Database. There is a pattern to do that and is important to be attended to because any user from the team can read the model. If not, all the knowledge about the project will be with a manager or a little part of the team.

SGBG - This is an acronym for "Database management system." Sometimes is common confusion between the concept of Database and SGBD. To be simple, just understand that the Database is a part of the SGBD. For example, the SGBD can control access to databases and tables in these databases.

Transaction System.

OLTP

Analytics Concepts

OLAP Fact Table Dimensions Cube