Skip to content

Anthony-Gaudino/fastapi_oracle_test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fastapi Oracle Test

This is a Python Fastapi test application that connects with an Oracle database.

Installation

This application should to be run on a x64 Debian based Linux distribution.

Tested on Ubuntu 20.04.1 x64, should also work on Debian 10.

Note: Requires Python >= 3.8

On a Linux terminal cd to the project root directory (same this file is present).

Run the install.sh script as root, this will install all necessary system dependencies:

foo@bar:~$ ./install.sh

Then install Python dependencies executing:

foo@bar:~$ pipenv install

Create database tables

Database Diagram

Executing the db.sql in Oracle will create the necessary database tables and populate them with some data.

Set database connection configuration

On the project root, edit the file app/database.py:

foo@bar:~$ vim app/database.py

On the section:

connect_url = URL(
    "oracle+cx_oracle",
    username="",
    password="",
    host="",
    port="",
    database=""
)

Fill in the host, username, password and database name.

Executing the test server instance

First switch to the project virtual environment:

foo@bar:~$ pipenv shell

Then run the uvicorn server:

(fastapi_oracle_test-Xvyp61cG) foo@bar:~$ uvicorn app.main:app

Visit http://127.0.0.1:8000/docs or http://127.0.0.1:8000/redoc to see the API documentation, from the first URL you can execute API calls.

Use the username user and password pass to authenticate.

About

Demo project using Fastapi to connect to an Oracle database

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published