Skip to content

Commit

Permalink
Rework project structure and publish on pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
ilevn committed Dec 5, 2020
1 parent 229fe4d commit ef47991
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 10 deletions.
23 changes: 20 additions & 3 deletions README.md → README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# sql-generator
sql-generator
=============

This tool lets you generate postgresql insert statements for common data types.
It's pretty minimalistic at the moment but offers support for basic statements
Expand All @@ -7,10 +8,26 @@ and foreign key relations.
In addition to that, `sql-generator` supports custom generators for table columns
and data types.

## Usage
Installation
------------
**Python 3.9 or higher is required**

To install the module, run the following command:
```
# Linux/macOS
python3 -m pip install -U sql-generator

# Windows
py -3 -m pip install -U sql-generator

# Poetry
poetry add sql-generator
```
Usage
-----

```python
from generator import Generator, write_results_to_file
from sql_generator import Generator, write_results_to_file
import psycopg2
# Custom converter for all columns or data types with
Expand Down
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

3 changes: 3 additions & 0 deletions sql_generator/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .analyser import Analyser
from .generator import Generator, write_results_to_file, flatten_dict_list
from .generators import *
File renamed without changes.
4 changes: 2 additions & 2 deletions generator.py → sql_generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import toposort

from analyser import Analyser
from generators import password_generator, first_name_generator, last_name_generator, text_generator, email_generator, \
from .analyser import Analyser
from .generators import password_generator, first_name_generator, last_name_generator, text_generator, email_generator, \
phone_generator, get_converter


Expand Down
4 changes: 2 additions & 2 deletions generators.py → sql_generator/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
from argon2 import PasswordHasher

# https://github.com/imsky/wordlists, Licenced: Copyright (c) 2017-2019 Ivan Malopinsky
FIRSTS = open("first.txt").readlines()
LASTS = open("last.txt").readlines()
FIRSTS = open("sql_generator/resources/first.txt").readlines()
LASTS = open("sql_generator/resources/last.txt").readlines()

PW_HASHER = PasswordHasher()
PRINTABLE = list(string.ascii_letters + string.digits + string.punctuation)
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit ef47991

Please sign in to comment.