Flask pyodbc odbc connect to SQL server docker google app engine - sql-server

After trying several approaches such as this one on Mac and I still get the error below when I do gcloud app deploy. I also tried manually adding the freetds driver to ODBC Manager GUI but once I cick 'Ok' it doesn't show in the list of drivers. Same thing happends for the DSN for both user and system. I would greatly appreciate any help.
Step 6/14 : ADD odbcinst.ini /etc/odbcinst.ini
ADD failed: stat /var/lib/docker/tmp/docker-builder438222044/odbcinst.ini: no such file or directory
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1

Related

Getting an error message from a sql server driver in my symfony project

I have tried to install the ODBC driver 18 for SQL Server in my symfony project. I am getting the following error messages. I wanted to ask if anyone could knows the solution for these.
An exception occurred in the driver: SQLSTATE[08001]: [Microsoft][ODBC
Driver 18 for SQL Server]SSL Provider: [error:16000069:STORE
routines::unregistered scheme:scheme=file][error:80000002:system
library::No such file or direc tory:calling
stat(/usr/local/etc/openssl#3/certs)][error:16000069:STORE
routines::unregistered scheme:scheme=file]
Environment details:
symfony version: 5.4.16
php8.1
Homebrew 3.6.16
apache 2.4.54
#AlwaysLearning's answer did help me.From the article linked, I checked the openssl#3 folder and I did see there was a cert.pem file. I then created a certs directory and copied the cert.pem file into that directory. That got of rid of my error message.
I did encounter an additional issue where I needed to add TrustServerCertificate parameter to the end of my connection string that is used to connect to the SQL server.
;TrustServerCertificate=1

Airflow 2.0 SQL Server connector

I want to use the airflow 2.01 docker-compose file from apaches github.
here is the link docker-compose.yaml and here is the link to the dockerfiledockerfile
I want to use a Dag which should grab data out of my SQL Server database. Actually I get the following error:
no module named pymssql
After I manually installed it, I get an error like no module named pyodbc.
When I want to install this manually I get an gcc error, that it is not possible to install.
Does anyone have any clue about this?
Is there any docker-compose file which is able to handle SQL Server connection for Airflow 2?
Thanks in advance

Install SQL SERVER Machine Learning Services (In-Database) Failed

I followed the SQL Server 2017 Setup wizard to install the Python Feature but completed with failures:
The database engine services has installed successful but Python and Machine Learning Services failed.
Below is the error detail:
>Error installing Machine Learning Services (In-Database)
>An error occurred while creating local user account SQLEXPRESS00.
>Error code: 0x85700005
And then I check the Summary log it say:
>Detailed results:
Feature: Python
Status: Failed
Reason for failure: An error occurred for a dependency of the feature causing the setup process for the feature to fail.
Next Step: Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
Component name: Machine Learning Services (In-Database)
Component error code: 0x85700005
Dose anyone have a solution?
My SQL Server 2017 version was 14.0.1000.169(RTM), I just update it to 14.0.3238.1 by install "Latest Cumulative Update for SQL Server 2017" and finally fix that issue~
Below is the link:
https://support.microsoft.com/en-us/help/4038634

Python cant find ODBC Driver on Heroku after setting everything

I have gone through every possible solution on the internet, but I'm unable to make pyobdc get the drivers on heroku.
The steps I have used to create the app are as follows:
heroku create
heroku config:set FLASK_CONFIG=heroku
heroku buildpacks:add heroku/python
heroku buildpacks:add --index 1 heroku-community/apt
git push heroku master
I tried even with odbc buildpack but still no luck:
heroku buildpacks:add https://github.com/iFix/heroku-buildpack-odbc.git
After going through microsoft website, I trimmed down my Aptfile to instuct heroku to install the following packages:
# install msodbcsql17
https://packages.microsoft.com/ubuntu/16.04/prod/pool/main/m/msodbcsql17/msodbcsql17_17.4.2.1-1_amd64.deb
# install mssql-tools
https://packages.microsoft.com/ubuntu/16.04/prod/pool/main/m/mssql-tools/mssql-tools_17.4.1.1-1_amd64.deb
# install unixodbc-dev
unixodbc-dev
This makes pyodbc installation go without error. But when I run pyodbc.drivers(), it returns nothing. The same command on Ubuntu 16.04 returns "ODBC Driver 17 for SQL Server"
The source code for the project is at : https://github.com/IamVNIE/odbcTestHeroku
The hosted app is at : https://pyodbctest.herokuapp.com/
Can someone please provide some pointers to make this work.
I have solved this issue by precompiling ODBC Driver 17 for SQL Server on a machine running Ubuntu 18.04 and copying the libmsodbcsql-17.5.so.2.1 and msodbcsqlr17.rll files into appropriate directories via a Heroku buildpack. This is ODBC Driver 17.5 for SQL Server and I likely won't be compiling other versions of this driver, but I imagine the concept remains the same.
The Heroku buildpack and its requirements can be found here https://github.com/matt-bertoncello/python-pyodbc-buildpack.git
Previous answer worked for me until I had to switch to heroku stack 22. After that I started getting the following error:
pyodbc.OperationalError: ('08001', '[08001] [unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection (0) (SQLDriverConnect)')
To solve this issue I switched to another library python pymssql, that handles connections to Microsoft SQL server in azure.
here is a simple example
conn = pymssql.connect(server=xxx,\
user=yyy, \
password=zzz, \
database=xxx)
cursor = conn.cursor(as_dict=True)
cursor.execute(query)
rows = cursor.fetchall()
cursor.close()
conn.close()

How to configure pgadmin4 (PostgreSQL)

When I finished installation postgresql-10.5 and ran pgadmin4 (that came installed with postgresql) I get a configuration error that says:
An error occurred initializing the application server:
Failed to launch application server, server thread existing
It then asks me to input a python path and an application path.
Can anybody help me and and advise what to do to run pgadmin4. I tried find problem solution, but nothing helped me(

Resources