GithubHelp home page GithubHelp logo

vreitech / mysqltokenizer Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 16 KB

Podman/Docker image for tokenize identifiers and/or literals of SQL queries (MySQL 8 dialect)

License: Other

Dockerfile 32.25% Python 67.75%

mysqltokenizer's Introduction

mysqltokenizer

Podman/Docker image for tokenize identifiers and/or literals of SQL queries (MySQL 8 dialect). This allows you to get a SQL query string with unique literals and/or unique identifiers replaced with tokens, which can be useful in cases of further analysis of the SQL query.

Used dependencies

ANTLR Project antlr4 4.12.0 using BSD-3-clause license

Python Software Foundation Python 3.11.3 using PSF license

Positive Technologies MySQL grammar using MIT License

Building and using image from git repo

Clone the repository to your environment using git:

git clone https://github.com/vreitech/mysqltokenizer.git
cd mysqltokenizer

Build mysqltokenizer image using buildah:

buildah bud -t mysqltokenizer

Run mysqltokenizer contaner using podman and tokenize SQL query by 4 different ways:

echo 'select * from `some_table` order by desc limit 10;' > ./example.sql

# Tokenize everything (identifiers and literals)
cat ./example.sql | podman run -i --rm localhost/mysqltokenizer

# Tokenize, but left identifiers untouched
cat ./example.sql | podman run -i --rm localhost/mysqltokenizer -i

# Tokenize, but left literals untouched
cat ./example.sql | podman run -i --rm localhost/mysqltokenizer -l

# Tokenize, but left identifiers and literals untouched
# (i. e. just capitalize ther rest of tokens and remove line feeds and extra spaces)
cat ./example.sql | podman run -i --rm localhost/mysqltokenizer -il

Using image from Docker Hub (or GitHub)

Run mysqltokenizer contaner using podman and tokenize SQL query by 4 different ways:

echo 'select * from `some_table` order by desc limit 10;' > ./example.sql

# Tokenize everything (identifiers and literals)
cat ./example.sql | podman run -i --rm docker.io/vreitech/mysqltokenizer

# Tokenize, but left identifiers untouched
cat ./example.sql | podman run -i --rm docker.io/vreitech/mysqltokenizer -i

# Tokenize, but left literals untouched
cat ./example.sql | podman run -i --rm docker.io/vreitech/mysqltokenizer -l

# Tokenize, but left identifiers and literals untouched
# (i. e. just capitalize ther rest of tokens and remove line feeds and extra spaces)
cat ./example.sql | podman run -i --rm docker.io/vreitech/mysqltokenizer -il

If you decided to pull the image from GitHub package storage you can replace docker.io onto ghcr.io in image URI.

mysqltokenizer's People

Contributors

vreitech avatar

Watchers

 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.