data of current selected table not showing in data tab

[expired user #9060]'s profile image [expired user #9060] posted 9 years ago in Import/Export Permalink
I have loaded a csv file using python sql connector and it appears that the records have loaded fine and I can see the status of the load. When I select the table and click on the data tab it is blank. I have tried loading direct from heidi using the import function and it works fine. I thought that as long as data is loaded I should be able to see the data automatically. I used the load data infile... to load the file. Am I missing something?

Ps completely new to this apologise if this is a basic non understanding, can anyone help?
kalvaro's profile image kalvaro posted 9 years ago Permalink
Uncommitted transaction in your Python code?
[expired user #9060]'s profile image [expired user #9060] posted 9 years ago Permalink
nope I used the following code:(responses output shown ##xxx##)- unless its the code that is an issue? I have even tried various forms of the query like adding in the table headers ... gives same result. The database actually shows the number of records loaded, I can't view or access them.

## loading data in a table ##

query = """LOAD DATA INFILE 'c:/data/CW_Data/GP_Practices.csv' REPLACE INTO TABLE gppractices FIELDS TERMINATED BY ',' IGNORE 1 LINES;"""

cur.execute(query)
#19800L#

db.commit ()
# built-in method of Connection object at 0x022394CB)##
ansgar's profile image ansgar posted 9 years ago Permalink
Post an excerpt of your csv file (2 or 3 first lines) and the CREATE TABLE query for gppractices. That way we can check more and probably help you.
[expired user #9060]'s profile image [expired user #9060] posted 9 years ago Permalink

Hi I have attached a sample of the csv file and the CREATE TABLE CODE, the table created fine


cur.execute("DROP TABLE IF EXISTS GPPRACTICES")

sql = """CREATE TABLE GPPRACTICES(ID CHAR(10) NOT NULL, DATE DATE, PRACTICE_ID CHAR (20), NAME TEXT, ADDRESS1 TEXT,
ADDRESS2 TEXT, ADDRESS3 TEXT, ADDRESS4 TEXT, POSTCODE TEXT, PC_ID CHAR (10))"""

cur.execute(sql)

Thanks in advance if anyone can help

1 attachment(s):
kalvaro's profile image kalvaro posted 9 years ago Permalink
I think the reference to CSV is a red herring. In the end, he has a table with rows but HeidiSQL's grid suggests it's empty.

Possibilities I can think of:

- Uncommited transaction
- Clicked on a different database and/or table (that happens!)
- There's a filter enabled
kalvaro's profile image kalvaro posted 9 years ago Permalink
Of course, running
SELECT COUNT(*) FROM GPPRACTICES
in a couple of places (e.g. HeidiSQL and the command-line client) never hurts.

Please login to leave a reply, or register at first.