Questions tagged [read-sql]

45 questions
0
votes
0 answers

Execution of a stored procedure in Python takes too long

I was hoping someone could help me with a certain issue... Here's a sample of a funtion I have: from pyodbc import connect from pandas import read_sql conn = connect('Driver={SQL…
0
votes
0 answers

Pandas returns empty dataframe

I'm using pd.read_sql and sqlserver to get the column names from a specific table. Pandas however only returns a empty dataframe whereas I'm getting valid results from ssms. Here is the code I'm using: query = f'''select * from…
0
votes
0 answers

Exporting MYSQL tables to csv through python script?

Although there are many solutions to export the mysql tables to csv using python. I want to know the best way of doing that? Currently I am storing around 50 tables to csv which takes around 47 minutes and also takes more than 16gb of memory. The…
Asad Khalil
  • 45
  • 1
  • 10
0
votes
0 answers

Reserving the exact float number with exact decimal places while accessing data from Access DB using Python, Pandas, pyodbc

I have accessed tables stored in Access DB using python, pandas, pyobdc through the pd.read_sql_query command. The table has float values which are used for predictive value calculations and while reading these float values from the table, Python is…
Arcanesaw
  • 29
  • 4
0
votes
1 answer

how to pass the sqlalchemyconnection string for oracle modin read_sql

UserWarning: To use parallel implementation of `read_sql`, pass the sqlalchemyconnection string instead of . I get gettign this error using this string 'oracle://username:password@server:1521/SID' I also tried…
user1082748
  • 365
  • 1
  • 7
  • 18
0
votes
0 answers

How to use Pyodbc to read in SQL results generated from joining 2 CTE's from 2 databases

I have a SQL script that joins two CTE's together, one CTE is from database1 and another CTE is from database2. It can be run successfully in SQL Server. However, I'd like to establish a connection between the SQL Server to Python using pyodbc…
Jiamei
  • 405
  • 3
  • 14
0
votes
0 answers

Optimizing pandas.read_sql for teradata

How can one read a teradata sql into a tempfile? The goal is to improve performance when ingesting data from an sql query into a pandas df. On https://towardsdatascience.com/optimizing-pandas-read-sql-for-postgres-f31cd7f707ab Tristan Crockett shows…
Felix313
  • 1
  • 1
0
votes
1 answer

Pd.read_sql add zero to int number from table sql server

I'm wondering why pandas.read_sql add .zero at the end of my data please ? In SQL Server, the data are number indicated like int. Someone knows why please? And when I look type of data, it's indicated like float64.
In_d_a
  • 21
  • 3
0
votes
0 answers

When I read a '.mdb' file using pyodbc+pandas(pd.read_sql), There are difference(Time data) between source data and memory data

I want to read mdb file to memory. but there are some difference between source data and memory data Here are code import pyodbc import pandas as pd import datetime DB_Connection = pyodbc.connect('DRIVER={Microsoft Access Driver…
0
votes
2 answers

How to apply map of parameters to read_sql from loop in python

I am trying to use a map to pass in values into a read_sql statement. Here's what I've tried: inventory = { 'fruit': ['apple', 'orange'], 'veggies': ['onion', 'cucumber'], } for type, items in inventory.items(): with…
silvercoder
  • 139
  • 1
  • 8
0
votes
1 answer

Adding SQL for loop in python

i am a newbees for programming, i have an db file with some date, open, high, low , close data in it, and name with 0001.HK; 0002.HK; 0003.HK then i try to build a loop to take out some data in the database. conn =…
y2kmarkham
  • 35
  • 1
  • 7
0
votes
1 answer

SQLAlchemy python copying table identically and pasting it elsewhere

I have a MySQL DB that has a table with a primary key which are VARCHAR(4) and contains 10 columns which contain FLOAT. I have attempted to copy the table and paste it elsewhere but when read_sql(), it changes the format of the table e.g. changing…
tenichols
  • 19
  • 4
0
votes
2 answers

panda.to_sql to call stored procedure with parameters via mysql.connector

I've got some Connection class which has __enter__ and __exit__ methods to return mysql.connector.MySQLConnection instance. What is required is to run mysql stored procedure and get data as dataframe. I've tried tons of ways using: ?, %s, :1,…
laggerok19
  • 426
  • 8
  • 16
-1
votes
1 answer

Running Complex SQL query using Python... Is it even possible?

I am trying to run a fairly complex SQL query from Python (Pandas) and am running into a question I see regularly. My SQL query is about 150 lines, and it is performing multiple tasks, accessing multiple(2) different databases, creating temp tables…
DeBur
  • 1
-1
votes
1 answer

loop through sql query which save in the dataframe?

user save the sql query in the pd , i want execute each the sql query then put into the same pd the dataframe like below colunm1 = 'id1' , 'id2 ' column2 = 'select sum(total) from table where data_mothrn ='2020-04'' , …
1 2
3