Welcome to the FastAPI application integrated with Google Cloud services, specifically BigQuery and Pub/Sub. This project demonstrates the seamless interaction between a FastAPI backend and Google Cloud for data storage and message processing.
- PostgreSQL Interaction: Retrieve user data from a PostgreSQL database.
- BigQuery Integration: Fetch data from and post data to BigQuery for structured and scalable storage.
- Google Pub/Sub Messaging: Utilize Pub/Sub for asynchronous communication by publishing and receiving messages.
- Main File (testtest.py): The main FastAPI application handling database queries, BigQuery operations, and Pub/Sub messaging.
- Requirements.txt: Lists all Python dependencies for the project.
- Dockerfile: Configures the Docker image to run the FastAPI application.
- CircleCI Configuration (config.yaml): Defines the CircleCI workflow for building and testing the application.
- Database Configuration: Configure PostgreSQL connection parameters in the
get_db
function. - Google Cloud Credentials: Replace the placeholder JSON file (
COPY YOUR_CREDENTIALS_FILE.json /app/credentials/
) with your Google Cloud service account credentials. - BigQuery Dataset: Create a BigQuery dataset named
COPY YOUR_CREDENTIALS_OF_DATASET
. - Pub/Sub Topic and Subscription: Modify topic and subscription names in the
topic_path
andsubscription_path
variables.
- GET /api/test: Retrieve user data from PostgreSQL.
- GET /bigquery_data: Fetch data from BigQuery.
- POST /post_to_bigquery: Post data to BigQuery.
- POST /publish_message: Publish a message to a Pub/Sub topic.
- POST /receive_message: Receive messages from a Pub/Sub subscription.
- Google Cloud Deployment: Deploy the FastAPI application to a Google Cloud Compute Engine or Cloud Run instance.
- Docker Image: Build and deploy the application using the Docker image (
mydock_image
).
- CircleCI Workflow: The CircleCI configuration ensures the build and deployment processes are seamless.
- FastAPI: The high-performance web framework for building APIs.
- Google Cloud Services:
- BigQuery: For storing and retrieving structured data.
- Pub/Sub: For asynchronous messaging between components.
- Docker: Containerization for easy deployment and scalability.
Feel free to customize this documentation based on your specific project details and additional features.