/Pyodbc_in_Azure

Python code integrated with Pyodbc library. It can store all repos of any Github user in a given Azure Sql Database.

Primary LanguagePython

POST GITHUB USER REPOSITORIES IN AZURE

This project makes a search for github users repositories and post to an Azure SQL Database.

Pre-requisites

You must have a existing Azure account with a SQL Database created.

Installation

  • Clone the repository
  • Install requests library using pip:
pip install requests
  • Install pyodbc library using pip:
pip install pyodbc

Running the code

  • Open the project folder in a development tool
  • Run the code using Python compiler

The interface asks for a Github username and print the existing repositories:

>>> Type the GitHub username to list his repositories and store them in a Azure SQL Database: {username}

>>> {username} repos: 
    ...
    ...
    ...

After that, it will ask for your Azure username, password, server name and database name:

>>> --Enter your Azure username and password--
>>> Username:
>>> Password:

>>> --Enter your Azure server and database name--
>>> Server name:
>>> Database name:

Then it will try to create a new table in the given database and insert the repos data:

>>> Trying to create new table and inserting repos id's, names and URLs to Azure SQL Database...

If everything goes right, the interface will print the following message:

>>> Succesfully inserted data in Azure Database! :)

More information

You can access the Requests library documentation here

You can access the Pyodbc library documentation here

You can watch this video on Youtube, to learn how to properly connect to Azure using pyodbc library if any connection error occurs.