Category : sql-server

I am looking to build a simple ETL solution using Python 3. The solution will be moving tables from one SQL Server to another SQL Server, and there will be no transformations necessary. Also, the SQL Server driver must support AAD access token authentication. I was looking at PETL but there doesn’t seem to be ..

Read more

Which works faster? Say I input data into a dataframe through the read_sql_query method. Which would work faster? Situation 1: If I filter the results I want within the read_sql_query_method Situation 2: if I input the entire database and filter using pandas methods Source: Python..

Read more

I have a csv files that I’m turning into a pandas dataframes (df), then manipulating the values in a couple of columns, and finally exporting the dataframe to a table in SQL Server. The code is: import pyodbc import sys df = pd.read_csv(f’../data/polreg/{sys.argv[3]}’, usecols=[0, 1, 2, 3, 4, 5, 8, 10, 11, 17, 18, 20]) ..

Read more

I made a code which gather datas from files and I want to put them in a database using pyodbc in python and SQL server express 2019. Here is my code : import pyodbc conn = pyodbc.connect(‘Driver={SQL SERVER};’ ‘Server=<my server>;’ ‘Database=<my database>;’ ‘Trusted_Connection=yes;’ cursor=conn.cursor() sql=""" INSERT INTO [dbo].[<my table>] ([data1] ,[data2] ,[data3] ,[data4]) VALUES (‘{0}’ ..

Read more

I have the following code in the main program: cleanDuplicatesAttendeesSQL = attendees.clean_duplicates() sqlUtilities.databaseWorkerExecute(cleanDuplicatesAttendeesSQL) attendees.clean_duplicates() sets the variable cleanDuplicatesAttendeesSQL: def clean_duplicates(): return """ WITH cte AS( SELECT [Sessions] ,[Confirmation #] ,[First Name] ,[Last Name] ,ROW_NUMBER() OVER ( PARTITION BY [Sessions] ,[Confirmation #] ,[First Name] ,[Last Name] ORDER BY [Sessions] ,[Confirmation #] ,[First Name] ,[Last Name] ) ..

Read more