Reading csv files using SQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pablo was Paolo

    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
  • Pablo was Paolo

    #2
    Re: Reading csv files using SQL

    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

    Comment

    • Paul McGuire

      #3
      Re: Reading csv files using SQL

      On Mar 1, 12:30 am, Pablo was Paolo <n...@spam.itwr ote:
      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

      Comment

      • Pablo was Paolo

        #4
        Re: Reading csv files using SQL

        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

        Comment

        • skip@pobox.com

          #5
          Re: Reading csv files using SQL

          >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

          Comment

          • Pablo was Paolo

            #6
            Re: Reading csv files using SQL

            skip@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

            Comment

            • Tim Golden

              #7
              Re: Reading csv files using SQL

              Pablo was Paolo wrote:
              skip@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

              Comment

              • Pablo was Paolo

                #8
                Re: Reading csv files using SQL

                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

                Comment

                Working...