473,321 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Reading csv files using SQL

Hi,
exists a Python library that allows to interface to csv files as if you
manage a database, using SQL language?

Something like csvjdbc in Java, where table name is file name and the
field's names are in first row.

Thanks!
Paolo
Feb 28 '07 #1
7 1880
Hi,

Dennis Lee Bieber ha scritto:
You could maybe use SQLite to load the CSV file and process in an
actual DBMS...
Ok, this is the solution I'm using actually (with PostGres).
My hope is to find a way to do the same thing without using a DBMS but
working directly with the files.

Thanks a lot,
Paolo
Mar 1 '07 #2
On Mar 1, 12:30 am, Pablo was Paolo <n...@spam.itwrote:
Hi,

Dennis Lee Bieber ha scritto:
You could maybe use SQLite to load the CSV file and process in an
actual DBMS...

Ok, this is the solution I'm using actually (with PostGres).
My hope is to find a way to do the same thing without using a DBMS but
working directly with the files.

Thanks a lot,
Paolo
Sqlite has an in-memory option, so that you can read in your csv, then
load into actual tables.

sqlite is really lightweight, you are using postgres now but sqlite in-
memory will get you a lot further than writing your own SQL processor.

-- Paul

Mar 1 '07 #3
Paul McGuire ha scritto:
Sqlite has an in-memory option, so that you can read in your csv, then
load into actual tables.
Thanks, this could be the perfect solution.

Paolo
Mar 1 '07 #4
>You could maybe use SQLite to load the CSV file and process in an
actual DBMS...
PabloOk, this is the solution I'm using actually (with PostGres). My
Pablohope is to find a way to do the same thing without using a DBMS
Pablobut working directly with the files.

If you want to work directly with the files why not just use Python's csv
module?

Skip

Mar 1 '07 #5
sk**@pobox.com ha scritto:
If you want to work directly with the files why not just use Python's csv
module?
Now, with Java, I use the same class to read several databases and csv
files (with SQL instructions).
I'd like to find a library for using the same approach in Python.

Thank you,
Paolo
Mar 1 '07 #6
Pablo was Paolo wrote:
sk**@pobox.com ha scritto:
>If you want to work directly with the files why not just use Python's csv
module?

Now, with Java, I use the same class to read several databases and csv
files (with SQL instructions).
I'd like to find a library for using the same approach in Python.
I vaguely remember that you can get an ODBC driver for CSV. If I'm
right, you could access it using one of the several Python ODBC
DBAPI modules... just a thought.

TJG
Mar 1 '07 #7
Tim Golden ha scritto:
I vaguely remember that you can get an ODBC driver for CSV.
There is a standard ODBC driver for use text file or csv, in windows.
But I use Linux on production servers.
I'd like to find a Python library or tool.

Thanks!
Paolo
Mar 1 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Lionel B | last post by:
Greetings, I need to read (unformatted text) from stdin up to EOF into a char buffer; of course I cannot allocate my buffer until I know how much text is available, and I do not know how much...
1
by: Michael Palmer | last post by:
I'm reading xml from SQL Server 2K with VB.net using an XSD schema file and SQLXML 3.0. I have the below code working fine, but I'd like to change the code from reading the schema file from a...
1
by: Magnus | last post by:
allrite folks, got some questions here... 1) LAY-OUT OF REPORTS How is it possible to fundamentaly change the lay-out/form of a report in access? I dont really know it that "difficult", but...
50
by: Michael Mair | last post by:
Cheerio, I would appreciate opinions on the following: Given the task to read a _complete_ text file into a string: What is the "best" way to do it? Handling the buffer is not the problem...
3
by: Brad | last post by:
I'm working on a web app which will display LARGE tiff image files (e.g files 10-20+ mb). Files are hidden from users direct access. For other, smaller image files I have used FileStream to read...
2
by: nnimod | last post by:
Hi. I'm having trouble reading some unicode files. Basically, I have to parse certain files. Some of those files are being input in Japanese, Chinese etc. The easiest way, I figured, to distinguish...
6
by: arne.muller | last post by:
Hello, I've come across some problems reading strucutres from binary files. Basically I've some strutures typedef struct { int i; double x; int n; double *mz;
10
by: Tyler | last post by:
Hello All: After trying to find an open source alternative to Matlab (or IDL), I am currently getting acquainted with Python and, in particular SciPy, NumPy, and Matplotlib. While I await the...
7
by: random guy | last post by:
Hi, I'm writing a program which creates an index of text files. For each file it processes, the program records the start and end positions (as returned by tellg()) of sections of interest,...
5
blazedaces
by: blazedaces | last post by:
Ok, so you know my problem, java is running out of memory reading with SAX, the event-based xml parser intended more-so than DOM for extremely large files. I'll try to explain what I've been doing...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.