quinta-feira, 23 de março de 2017

Conectar-se ao Banco de Dados SQL usando Python3 - Usando Ubuntu



$ sudo apt-get install python3-pyodbc

$ sudo apt-get install curl

$ sudo su curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -

$ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql.list

$ exit

$ sudo apt-get update sudo apt-get install msodbcsql mssql-tool

$ python3
-------------------------------------------

Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyodbc
>>> server = 'yourserver.database.windows.net'

>>> database = 'yourdatabase'
>>> username = 'yourusername'
>>> password = 'yourpassword'
>>> driver= '{ODBC Driver 13 for SQL Server}'
>>> cnxn = pyodbc.connect('DRIVER='+driver+';PORT=1433;SERVER='+server+';PORT=1443;DATABASE='+database+';UID='+username+';PWD='+ password)


>>> cursor = cnxn.cursor()
>>> cursor.execute("select @@VERSION")
>>> row = cursor.fetchone()
>>> if row:
>>>    print(row)

quinta-feira, 9 de março de 2017

BAIXAR CURSO DA UDEMY PELO PYTHON 3

Instale o módulo udemy-dl do python3.

sudo pip3 install udemy-dl 
ou 
python3 -m pip install udemy-dl

Para baixar:

$ udemy-dl -u USUÁRIO -p SENHA https://www.udemy.com/programacao-orientada-a-objetos-com-python/learn/v4/t/lecture/5749688?start=15

 

Quem é Almir JR