Hello @Pranav Kumar,
welcome to this moderated Azure community forum.
Although not written in Python, see this guide to ingest data programmatically using a regular Azure Data Explorer.
Is this what you want to achieve?
As you can see, your code relies on an identity to access the database.
If this does not work for your case, I recommend checking out the free ADX streaming ingestion via an Event Hub. Check out this post for details.
If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.