{"id":20763657,"url":"https://github.com/infosys/snowflake-python-development-framework","last_synced_at":"2025-04-30T07:50:12.713Z","repository":{"id":57468987,"uuid":"235968778","full_name":"Infosys/Snowflake-Python-Development-Framework","owner":"Infosys","description":"This package helps developers to build applications using snowflake quickly.","archived":false,"fork":false,"pushed_at":"2020-08-28T17:01:40.000Z","size":57,"stargazers_count":6,"open_issues_count":3,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-14T06:04:54.533Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Infosys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-24T08:55:30.000Z","updated_at":"2024-09-28T14:47:23.000Z","dependencies_parsed_at":"2022-09-19T10:10:23.256Z","dependency_job_id":null,"html_url":"https://github.com/Infosys/Snowflake-Python-Development-Framework","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infosys%2FSnowflake-Python-Development-Framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infosys%2FSnowflake-Python-Development-Framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infosys%2FSnowflake-Python-Development-Framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infosys%2FSnowflake-Python-Development-Framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Infosys","download_url":"https://codeload.github.com/Infosys/Snowflake-Python-Development-Framework/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251666227,"owners_count":21624291,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T10:45:07.018Z","updated_at":"2025-04-30T07:50:12.692Z","avatar_url":"https://github.com/Infosys.png","language":"Python","readme":"# Snowflake-Python-Development-Framework\nSnowflake SDK for python\n\nThis package has been built to help developers build applications using [snowflake](https://www.snowflake.com) quickly. Below listed are some examples on how to work with this package\n\n## Create a snowflake connection\nYou can create the connection using either a [private key](https://docs.snowflake.com/en/user-guide/snowsql-start.html#using-key-pair-authentication) or [password](https://docs.snowflake.com/en/user-guide/snowsql-start.html#specifying-passwords-when-connecting). The connection details have to be upated in the [conf.ini](./connections/conf.ini) file\n\nThe below piece of code connects to snowflake and returns the connection object, statuscode and statusmessage\n\n```python\n\nfrom utilities.sf_operations import snowflakeconnection\n\nconnection = snowflakeconnection(profilename ='snowflake_host')\nsfconnectionresults = connection.get_snowflake_connection()\n\nsfconnection = sfconnectionresults.get('connection')\nstatuscode = sfconnectionresults.get('statuscode')\nstatusmessage = sfconnectionresults.get('statusmessage')\n\nprint(sfconnection,statuscode,statusmessage)\n\n```\n\n## Execute a query in snowflake\nThe below piece of code executes a query in snowflake\n\n```python\nfrom utilities.sf_operations import snowflakeconnection\nconnection = snowflakeconnection(profilename ='snowflake_host')\nsfconnectionresults = connection.get_snowflake_connection()\n\nsfconnection = sfconnectionresults.get('connection')\nstatuscode = sfconnectionresults.get('statuscode')\nstatusmessage = sfconnectionresults.get('statusmessage')\n\nquerystring = \"select * from sales;\"\nqueryresult = connection.execute_snowquery(sfconnection,querystring)\n\nqueryid = queryresult.get('queryid') #This is the query id in SF\nexecutionresult = queryresult.get('result')\nstatuscode = queryresult.get('statuscode')\nstatusmessage = queryresult.get('statusmessage')\n\nprint (queryid,statuscode,statusmessage)\nfor results in executionresult:\n    print(results)\n\nsfconnection.close()\n\n```\n\n## Execute a query in snowflake in asynchrouos mode\nThis uses the same function but with asyncflag as true\n\n```python\nfrom utilities.sf_operations import snowflakeconnection\nconnection = snowflakeconnection(profilename ='snowflake_host')\nsfconnectionresults = connection.get_snowflake_connection()\n\nsfconnection = sfconnectionresults.get('connection')\nstatuscode = sfconnectionresults.get('statuscode')\nstatusmessage = sfconnectionresults.get('statusmessage')\n\n#print(sfconnection,statuscode,statusmessage)\n\nquerystring = \"select * from ADMCOE_SALES;\"\nqueryresult = connection.execute_snowquery(sfconnection,querystring,asyncflag=True)\n\nqueryid = queryresult.get('queryid')\nexecutionresult = queryresult.get('result')\nstatuscode = queryresult.get('statuscode')\nstatusmessage = queryresult.get('statusmessage')\n\n```\n\n## Execute a snowflake script in snowflake\nThis feature can be used to execute a script file with one or\nmore snowflake queries\n\n```python\nfrom utilities.sf_operations import snowflakeconnection\nconnection = snowflakeconnection(profilename ='snowflake_host')\nsfconnectionresults = connection.get_snowflake_connection()\n\nsfconnection = sfconnectionresults.get('connection')\nstatuscode = sfconnectionresults.get('statuscode')\nstatusmessage = sfconnectionresults.get('statusmessage')\n\n#print(sfconnection,statuscode,statusmessage)\n\nfilename = \"D://script.sql\"\nqueryresult = connection.execute_stream(sfconnection,filename)\n\nexecutionresult = queryresult.get('result')\nstatuscode = queryresult.get('statuscode')\nstatusmessage = queryresult.get('statusmessage')\n\nfor cursor in executionresult:\n    for ret in cursor:\n        print(ret)\n\nprint (executionresult,statuscode,statusmessage)\n\nsfconnection.close()\n```\n\n\nBelow features are currently in development\n\n1. Put file to a stage after splitting into multiple files\n2. Compress files before putting them to stage\n3. Archive files after putting them to stage\n\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfosys%2Fsnowflake-python-development-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfosys%2Fsnowflake-python-development-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfosys%2Fsnowflake-python-development-framework/lists"}