Giter VIP home page Giter VIP logo

querycsv's Introduction

Query On CSV Version 3.0 12/22/2017

Target in the scenarios that users want to acquire information from CSV files without putting data into a dataset, we developed this python-based software to ask questions over huge amount of data(300 attributes, millions of rows).

General Usage Notes

  • Install an IDE for Python, e.g. Spyder or PyCharm
  • Make sure you have Python files and CSV files in the same directory
  • Open 'test_query.py'
  • Modify file_path to current folder path (We don't have a user interface yet)
  • Declare input query
  • Build index first (Call build_index(), check instructions in build_index.py)
  • Run 'test_query.py'

Query syntax

  • The input query should be a string ended with a semicolon (;).
  • The logic operators (SELECT, FROM, WHERE, AND, OR, NOT, LIKE) are case-sensitive and expected to be uppercase.
  • Use comma (,) to separate attributes in SELECT clause, files in FROM clause, conditions in WHERE clause.
  • Leave at least ONE space on both sides for operator(>, >=, <, <=, =, <>, AND, OR, NOT, LIKE).
  • For LIKE, the pattern should be in string format with single quotes (' ').
  • Rename required for querying two or more tables

Example query:

"SELECT movie_title, title_year, imdb_score FROM movies.csv WHERE ( movie_title LIKE '%Kevin%' AND imdb_score > 7 );

Result:

['We Need to Talk About Kevin', '2011', '7.5'] ['Kevin Hart: Laugh at My Pain', '2011', '7.5']

Example query 2:

"SELECT M.movie_title, A.Award FROM movies.csv M, oscars.csv A WHERE A.Name LIKE '%Kevin%' AND A.Winner = 1 AND A.Award = 'Actor in a Leading Role' AND A.Name = M.actor_1_name AND M.title_year > 2000 AND M.budget > M.gross AND M.movie_title LIKE '%Superman%' ;"

Result:

['Superman Returns', 'Actor in a Leading Role']


Some queries are provided in the 'test_query.py'.

Feel free to contact me: [email protected], if you have any issue in running the program.

Upcoming features

  • Handling query with at least two pairs of parentheses
  • Handling query with arithmatic expression
  • User interface
  • Querying 4 tables

Copyright 2017 GSON - Zhenfeng CHEN, Yekai YU, Lu JIN, Xi LI

querycsv's People

Contributors

zfchen95 avatar lillianjin avatar yekai-yu avatar lulucikyo avatar

Stargazers

 avatar  avatar  avatar Yusa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.