Hi I'm trying to integrate Snowflake with Sharepoint. We want to write the data from Snowflake into Sharepoint files and vice versa. Read the data from sharepoint files and load into Snowflake using Python.
We are not looking to use a separate integration tool. We have Python used to integrate other source systems & looking to continue the same. Looking for some references or sample use cases
Yes it is possible through Python. Here is a python code that helped me with the same requirement. I am uploading the snowflake query result as a json file to sharepoint
##Getting Imports
from snowflake.sqlalchemy import URL
from shareplum import Office365
from shareplum import Site
from shareplum.site import Version
import pandas as pd
import json
import snowflake.connector
##Connecting to snowflake
con_var = snowflake.connector.connect(
user = 'your_username',
password = 'your_password',
account = 'account_name',
warehouse = 'snowflake_warehouse',
database = 'database_name',
schema = 'schema_type'
)
## Connecting to sharepoint
server_url = "https://yourlink.sharepoint.com/"
site_url = server_url + "sites/your_site_name"
Username = "sp_userid"
Password = "sp_password"
sql_stmt = """ select * from "DB".table_name """
##Writing query result to sharepoint
authcookie = Office365(server_url, username = Username, password=Password).GetCookies()
site = Site(site_url, version=Version.v365, authcookie=authcookie)
folder = site.Folder('Shared Documents/Your_Folder')
df = pd.read_sql(sql_stmt,con_var)
folder.upload_file(df.to_json(orient='records'),'out_file.json')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With