{"id":226,"date":"2022-03-21T17:57:16","date_gmt":"2022-03-21T16:57:16","guid":{"rendered":"https:\/\/www.panahy.nl\/?p=226"},"modified":"2022-04-05T16:37:48","modified_gmt":"2022-04-05T14:37:48","slug":"getting-started-with-python","status":"publish","type":"post","link":"http:\/\/panahy.nl\/index.php\/2022\/03\/21\/getting-started-with-python\/","title":{"rendered":"Getting started with Python"},"content":{"rendered":"\n<p>This article is about all you need to setup Python on Windows for a .Net Developer working on Windows using SQL Server.<\/p>\n\n\n\n<p>Install Latest Python for Windows: https:\/\/www.python.org\/downloads\/windows\/<br>-&gt; My choice today: 3.10.3 <a href=\"https:\/\/www.python.org\/ftp\/python\/3.10.3\/python-3.10.3-amd64.exe\">Windows installer (64-bit)<\/a><\/p>\n\n\n\n<p>Installing <strong>Python extension for Visual Studio Code <\/strong>which enables Jupiter Notebook<br>Installing <strong>Python for VSCode <\/strong>which brings syntax highlighting<br>Installing <strong>Python Extension Pack <\/strong>which supports intelliSense<br>Installing ODBC driver<br><code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">pip install pyodbc<\/code><\/p>\n\n\n\n<p>Sample code to run: <\/p>\n\n\n\n<div class=\"wp-container-1 wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<pre class=\"wp-block-preformatted\"><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import pyodbc <\/code>\n<code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">conn_str = (\"Driver={SQL Server};\"<\/code>\n<code data-enlighter-language=\"prolog\" class=\"EnlighterJSRAW\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"Server='tcp:myserver.database.windows.net;\"<\/code>\n<code data-enlighter-language=\"prolog\" class=\"EnlighterJSRAW\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"Database=mydb;\"<\/code>\n<code data-enlighter-language=\"prolog\" class=\"EnlighterJSRAW\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"UID=sqlUser;\"<\/code>\n<code data-enlighter-language=\"prolog\" class=\"EnlighterJSRAW\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"PWD=myPassWord;\"<\/code>\n<code data-enlighter-language=\"prolog\" class=\"EnlighterJSRAW\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \"Trusted_Connection=no;\") <\/code>\n<code data-enlighter-language=\"prolog\" class=\"EnlighterJSRAW\">conn = pyodbc.connect(conn_str)<\/code>\n<code data-enlighter-language=\"prolog\" class=\"EnlighterJSRAW\">cursor = conn.cursor()<\/code>\n<code data-enlighter-language=\"prolog\" class=\"EnlighterJSRAW\">sql_str = (\"SET NOCOUNT ON; \\n\"<\/code>\n<code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\"select * from myTable\"<\/code>\n<code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<\/code>\n<code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">cursor.execute(sql_str<\/code><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">)<\/code>\n<code data-enlighter-language=\"purebasic\" class=\"EnlighterJSRAW\">for row in cursor:<\/code>\n<code data-enlighter-language=\"purebasic\" class=\"EnlighterJSRAW\">&nbsp; &nbsp; print(row)<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<p>Nice to read more: https:\/\/wiki.python.org\/moin\/BeginnersGuide\/Programmers<\/p>\n\n\n\n<p>Next: <\/p>\n\n\n\n<ul><li>Installing Jupiter Notebook from https:\/\/jupyter.org\/install<\/li><li>Installing Pandas as part of Anaconda: <br>https:\/\/pandas.pydata.org\/pandas-docs\/stable\/getting_started\/install.html<\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This article is about all you need to setup Python on Windows for a .Net Developer working on Windows using SQL Server. Install Latest Python for Windows: https:\/\/www.python.org\/downloads\/windows\/-&gt; My choice today: 3.10.3 Windows installer (64-bit) Installing Python extension for Visual Studio Code which enables Jupiter NotebookInstalling Python for VSCode which brings syntax highlightingInstalling Python Extension &hellip; <a href=\"http:\/\/panahy.nl\/index.php\/2022\/03\/21\/getting-started-with-python\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Getting started with Python&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,116,24],"tags":[109,107,108],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"post-thumbnail":false},"uagb_author_info":{"display_name":"Pouya Panahy","author_link":"http:\/\/panahy.nl\/index.php\/author\/pouya\/"},"uagb_comment_info":0,"uagb_excerpt":"This article is about all you need to setup Python on Windows for a .Net Developer working on Windows using SQL Server. Install Latest Python for Windows: https:\/\/www.python.org\/downloads\/windows\/-&gt; My choice today: 3.10.3 Windows installer (64-bit) Installing Python extension for Visual Studio Code which enables Jupiter NotebookInstalling Python for VSCode which brings syntax highlightingInstalling Python Extension&hellip;","_links":{"self":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/226"}],"collection":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/comments?post=226"}],"version-history":[{"count":7,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/226\/revisions"}],"predecessor-version":[{"id":239,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/posts\/226\/revisions\/239"}],"wp:attachment":[{"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/media?parent=226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/categories?post=226"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/panahy.nl\/index.php\/wp-json\/wp\/v2\/tags?post=226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}