HiveSQL
Search…
HiveSQL for Python developers
Use the following code to connect to SteemSQL using Python:
1
import pypyodbc
2
connection = pypyodbc.connect('Driver={ODBC Driver 13 for SQL Server};'
3
'Server=sql.steemsql.com;'
4
'Database=DBSteem;'
5
'uid=steemit;pwd=steemit')
6
cursor = connection.cursor()
7
SQLCommand = ("YOUR SQL QUERY”)
8
cursor.execute(SQLCommand)
9
# do whatever you want with the retrieved data
10
connection.close()
Copied!
Remember you need to have ODBC drivers installed on your computer.
How to install the Microsoft ODBC Driver for SQL Server on Linux and macOS
On Debian 9
1
sudo curl https://ift.tt/2OlWDWn > /etc/apt/sources.list.d/mssql-release.list
2
sudo apt-get update
3
sudo ACCEPT_EULA=Y apt-get install msodbcsql17
Copied!
Optional for bcp and sqlcmd
1
sudo ACCEPT_EULA=Y apt-get install mssql-tools
2
echo ‘export PATH=”$PATH:/opt/mssql-tools/bin”‘ >> ~/.bash_profile
3
echo ‘export PATH=”$PATH:/opt/mssql-tools/bin”‘ >> ~/.bashrc
4
source ~/.bashrc
Copied!
Optional for unixODBC development headers
1
sudo apt-get install unixodbc-dev
Copied!
For more details on how to install Microsoft SQL ODBC drivers, you can read this post published by @geekgirl
Last modified 8mo ago
Copy link