Python SQL Server Example Issue

ddthal 96 Reputation points
2021-08-11T13:36:33.613+00:00

I have walked through the Microsoft documentation for python integration with SQL Server using pyodbc and revoscalepy:

https://learn.microsoft.com/en-us/sql/machine-learning/python/setup-python-client-tools-sql?view=sql-server-ver15#6---test-remote-connection

I have run all steps successfully until 5-3 (using revoscalepy to create table and load Iris data). I am able to create a database using pyodbc as demonstrated in 5-1, but in 5-3, code runs without error, it signifies the appropriate amount of rows successfully read and written, but no table appears in SQL Server.

Has anyone else successfully walked through this tutorial?

Thank you.

from revoscalepy import RxSqlServerData, rx_data_step

Example of using RX APIs to load data into SQL table. You can also do this with pyodbc

table_ref = RxSqlServerData(connection_string=connection_string.format(new_db_name), table="iris_data")
rx_data_step(input_data = df, output_file = table_ref, overwrite = True)

print("New Table Created: Iris")
print("Sklearn Iris sample loaded into Iris table")

122382-image.png

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,977 questions
Azure Data Science Virtual Machines
Azure Data Science Virtual Machines
Azure Virtual Machine images that are pre-installed, configured, and tested with several commonly used tools for data analytics, machine learning, and artificial intelligence training.
69 questions
{count} votes

Accepted answer
  1. ddthal 96 Reputation points
    2021-08-16T18:58:10.153+00:00

    My mistake, the tutorial was working. It was writing to the "master" database instead of the new database created. Thank you.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. ddthal 96 Reputation points
    2021-08-12T14:53:56.76+00:00

    SQL Server Version 15.0.18206.0
    Python Version 3.5.2


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.