files hosted elsewhere

These files have been relocated elsewhere
This commit is contained in:
akatesmith
2021-01-06 08:34:23 -08:00
parent fbbd2ec64d
commit 1b1a444ab3
79 changed files with 0 additions and 5490 deletions
@@ -1,15 +0,0 @@
---
page_type: sample
languages:
- ruby
products:
- azure-sql-database
---
# Developing applications with Python and Azure SQL
Pick a platform below to get started:
* [unix-based (Includes macOS, RHEL, Ubuntu, SLES](https://github.com/Microsoft/sql-server-samples/tree/master/samples/tutorials/AzureSqlGettingStartedSamples/python/Unix-based)
* [Windows](https://github.com/Microsoft/sql-server-samples/tree/master/samples/tutorials/AzureSqlGettingStartedSamples/python/Windows)
Please visit our [getting started tutorials](https://www.microsoft.com/en-us/sql-server/developer-get-started/)
@@ -1,29 +0,0 @@
import pyodbc
import datetime
server = 'your_server.database.windows.net'
database = 'your_database'
username = 'your_user'
from azure.identity import DefaultAzureCredential
from azure.keyvault.secrets import SecretClient
credential = DefaultAzureCredential()
secret_client = SecretClient(vault_url="https://<your_key_vault_name>.vault.azure.net", credential=credential)
# NOTE: please replace the ("<your-secret-name>") with the name of the secret in your vault
secret = secret_client.get_secret("AppSecret")
password = secret.value
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = cnxn.cursor()
tsql = "SELECT SUM(Price) as sum FROM Table_with_3M_rows"
a = datetime.datetime.now()
with cursor.execute(tsql):
b = datetime.datetime.now()
c = b - a
for row in cursor:
print ('Sum:', str(row[0]))
print ('QueryTime:', c.microseconds, 'ms')
@@ -1,37 +0,0 @@
import pyodbc
server = 'your_server.database.windows.net'
database = 'your_database'
username = 'your_user'
password = 'your_password'
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = cnxn.cursor()
print ('Inserting a new row into table')
#Insert Query
tsql = "INSERT INTO Employees (Name, Location) VALUES (?,?);"
with cursor.execute(tsql,'Jake','United States'):
print ('Successfully Inserted!')
#Update Query
print ('Updating Location for Nikita')
tsql = "UPDATE Employees SET Location = ? WHERE Name = ?"
with cursor.execute(tsql,'Sweden','Nikita'):
print ('Successfully Updated!')
#Delete Query
print ('Deleting user Jared')
tsql = "DELETE FROM Employees WHERE Name = ?"
with cursor.execute(tsql,'Jared'):
print ('Successfully Deleted!')
#Select Query
print ('Reading data from table')
tsql = "SELECT Name, Location FROM Employees;"
with cursor.execute(tsql):
row = cursor.fetchone()
while row:
print (str(row[0]) + " " + str(row[1]))
row = cursor.fetchone()
@@ -1,50 +0,0 @@
import pyodbc
server = 'your_server.database.windows.net'
database = 'your_database'
username = 'your_user'
from azure.identity import DefaultAzureCredential
from azure.keyvault.secrets import SecretClient
credential = DefaultAzureCredential()
secret_client = SecretClient(vault_url="https://<your_keyvault_name>.vault.azure.net", credential=credential)
# NOTE: please replace the ("<your-secret-name>") with the name of the secret in your vault
secret = secret_client.get_secret("AppSecret")
password = secret.value
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = cnxn.cursor()
print ('Inserting a new row into table')
#Insert Query
tsql = "INSERT INTO Employees (Name, Location) VALUES (?,?);"
with cursor.execute(tsql,'Jake','United States'):
print ('Successfully Inserted!')
#Update Query
print ('Updating Location for Nikita')
tsql = "UPDATE Employees SET Location = ? WHERE Name = ?"
with cursor.execute(tsql,'Sweden','Nikita'):
print ('Successfully Updated!')
#Delete Query
print ('Deleting user Jared')
tsql = "DELETE FROM Employees WHERE Name = ?"
with cursor.execute(tsql,'Jared'):
print ('Successfully Deleted!')
#Select Query
print ('Reading data from table')
tsql = "SELECT Name, Location FROM Employees;"
with cursor.execute(tsql):
row = cursor.fetchone()
while row:
print (str(row[0]) + " " + str(row[1]))
row = cursor.fetchone()
@@ -1,11 +0,0 @@
## Sample details
Please visit the [Python tutorials](https://www.microsoft.com/en-us/sql-server/developer-get-started) and select RHEL, Ubuntu, SLES, or macOs to run through the sample in full with more detail.
<a name=disclaimers></a>
The scripts and this guide are provided as samples. They are not part of any Azure service and are not covered by any SLA or other Azure-related agreements. They are provided as-is with no warranties express or implied. Microsoft takes no responsibility for the use of the scripts or the accuracy of this document. Familiarize yourself with the scripts before using them.
## Related Links
For more information, see these articles:
* To see more getting started tutorials, visit our [tutorials page](https://www.microsoft.com/en-us/sql-server/developer-get-started/)
@@ -1,29 +0,0 @@
import pyodbc
import datetime
server = 'your_server.database.windows.net'
database = 'your_database'
username = 'your_user'
from azure.identity import DefaultAzureCredential
from azure.keyvault.secrets import SecretClient
credential = DefaultAzureCredential()
secret_client = SecretClient(vault_url="https://<your_key_vault_name>.vault.azure.net", credential=credential)
# NOTE: please replace the ("<your-secret-name>") with the name of the secret in your vault
secret = secret_client.get_secret("AppSecret")
password = secret.value
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = cnxn.cursor()
tsql = "SELECT SUM(Price) as sum FROM Table_with_3M_rows"
a = datetime.datetime.now()
with cursor.execute(tsql):
b = datetime.datetime.now()
c = b - a
for row in cursor:
print ('Sum:', str(row[0]))
print ('QueryTime:', c.microseconds, 'ms')
@@ -1,37 +0,0 @@
import pyodbc
server = 'your_server.database.windows.net'
database = 'your_database'
username = 'your_user'
password = 'your_password'
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = cnxn.cursor()
print ('Inserting a new row into table')
#Insert Query
tsql = "INSERT INTO Employees (Name, Location) VALUES (?,?);"
with cursor.execute(tsql,'Jake','United States'):
print ('Successfully Inserted!')
#Update Query
print ('Updating Location for Nikita')
tsql = "UPDATE Employees SET Location = ? WHERE Name = ?"
with cursor.execute(tsql,'Sweden','Nikita'):
print ('Successfully Updated!')
#Delete Query
print ('Deleting user Jared')
tsql = "DELETE FROM Employees WHERE Name = ?"
with cursor.execute(tsql,'Jared'):
print ('Successfully Deleted!')
#Select Query
print ('Reading data from table')
tsql = "SELECT Name, Location FROM Employees;"
with cursor.execute(tsql):
row = cursor.fetchone()
while row:
print (str(row[0]) + " " + str(row[1]))
row = cursor.fetchone()
@@ -1,50 +0,0 @@
import pyodbc
server = 'your_server.database.windows.net'
database = 'your_database'
username = 'your_user'
from azure.identity import DefaultAzureCredential
from azure.keyvault.secrets import SecretClient
credential = DefaultAzureCredential()
secret_client = SecretClient(vault_url="https://<your_keyvault_name>.vault.azure.net", credential=credential)
# NOTE: please replace the ("<your-secret-name>") with the name of the secret in your vault
secret = secret_client.get_secret("AppSecret")
password = secret.value
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
cursor = cnxn.cursor()
print ('Inserting a new row into table')
#Insert Query
tsql = "INSERT INTO Employees (Name, Location) VALUES (?,?);"
with cursor.execute(tsql,'Jake','United States'):
print ('Successfully Inserted!')
#Update Query
print ('Updating Location for Nikita')
tsql = "UPDATE Employees SET Location = ? WHERE Name = ?"
with cursor.execute(tsql,'Sweden','Nikita'):
print ('Successfully Updated!')
#Delete Query
print ('Deleting user Jared')
tsql = "DELETE FROM Employees WHERE Name = ?"
with cursor.execute(tsql,'Jared'):
print ('Successfully Deleted!')
#Select Query
print ('Reading data from table')
tsql = "SELECT Name, Location FROM Employees;"
with cursor.execute(tsql):
row = cursor.fetchone()
while row:
print (str(row[0]) + " " + str(row[1]))
row = cursor.fetchone()
@@ -1,11 +0,0 @@
## Sample details
Please visit the [Python on Windows tutorial](https://www.microsoft.com/en-us/sql-server/developer-get-started/php/windows/az) to run through the sample in full with more detail.
<a name=disclaimers></a>
The scripts and this guide are provided as samples. They are not part of any Azure service and are not covered by any SLA or other Azure-related agreements. They are provided as-is with no warranties express or implied. Microsoft takes no responsibility for the use of the scripts or the accuracy of this document. Familiarize yourself with the scripts before using them.
## Related Links
For more information, see these articles:
* To see more getting started tutorials, visit our [tutorials page](https://www.microsoft.com/en-us/sql-server/developer-get-started/)