semvec/pypi-packages huggingface dataset:
sql2nosql 0.3.33
Migrate data from SQL to NoSQL easily
License: MIT
Keywords: sql,nosql,migrator,sql2nosql,migrate

<p align="center">
    <img src="https://i.ibb.co/VDNZpvZ/logo-transparent.png" width="450">
</p>
<p align="center" style="font-size:200px;">
    Migrate data from SQL to NoSQL easily
</p>
<div align="center" style="display:inline;">
<img src="https://img.shields.io/badge/python-%203.6%20|%203.7%20|%203.8%20|%203.9%20-blue" />
<img src="https://img.shields.io/badge/black-v21.6b0-blue" />
<img src="https://img.shields.io/github/downloads/facundopadilla/sql2nosql/total?style=plastic" />
<img src="https://img.shields.io/pypi/v/sql2nosql" />
</div>


## Installation 💯
```python
pip install sql2nosql --upgrade
```

## Dependencies 📢

For the package to work, it first needs "clients", which are other packages that are in charge of managing the data in the database. Most of them work very similar, as in the case of 'mysql-connector' and 'pymysql' for MySQL databases, and 'PyMongo' for MongoDB databases.

For example, the parameter 'sql_client' of the Migrator() class, receives by parameter a string where it is indicated which is the "client" to use, for example:
```python
from sql2nosql import Migrator

Migrator(sql_client="mysql.connector")
```
For this case, you will need to manually install 'mysql.connector', as it is not a 'native package' of Python, therefore, the installation you need to do is as follows: `pip install mysql-connector-python`

In case you want to use 'pymysql', then first install it: `pip install pymysql`
And then pass it as a parameter in the form of a string:

```python
from sql2nosql import Migrator

Migrator(sql_client="pymysql")
```

SQL2NoSQL takes care of the rest.

### ⚠️ Attention:

It is not yet implemented with PostgreSQL, SQLite3 and SQLServer, but will be tested with those databases soon. For the moment, it works with MySQL and MariaDB.

## How to use 🤓
#### Basic usage
You indicate the SQL and NoSQL database connection data in a dictionary, and the "client"/"engine" you normally use for this conversion (I recommend PyMongo for MongoDB).
```python
from sql2nosql import Migrator

host = "0.0.0.0"

sql_config = {
    "host": host,
    "port": 33060,
    "username": "root",
    "password": "1234",
    "database": "classicmodels",
}

nosql_config = {
    "host": host,
    "port": 27018,
    "username": "sql2nosql",
    "password": "1234",
}

migrator = Migrator(
    sql_config=sql_config,
    nosql_config=nosql_config,
    sql_client="mysql.connector",
    nosql_client="pymongo",
)

migrator.migrate_data(tables=["customers", "employees", "offices"])

```
## Full example with another dependencies 👽

If you want to see a more complete example of how to use this package, visit this repository: [Click me!](https://github.com/facundopadilla/sql2nosql-example "Click me!")



https://user-images.githubusercontent.com/64610246/123431691-eeeda480-d59f-11eb-8dbc-0865cace8a39.mp4
mrmime 0.0.1
A streaming mime parser
License: MIT
Requires Python: >=3.9,<4.0

# mrmime, a fast and memory efficient streaming MIME parser

This isn't API stable or even really stable at all yet. A lot of features are missing.
You shouldn't use this unless you're willing to actively help me with it.

## Why?

`email` is a memory hog, very rigid and not particularly fast. I parse a _lot_ of email
at work and I only need a couple of things:
 - I want to control storage. I don't need large objects that represent the entire
   parsed message, I need specific fields.
 - I want to control how I read up mime parts. I don't want massive strings.
 - I don't want to load the entire file into memory.
 - No serialization, only parsing.
 - I want it to be fast.
 - I want it to be intuitive.

## Examples

Simple example showing how to use it:

```python

from mrmime import BodyLineEvent, HeaderEvent, parse_file


with open("tests/data/simple.eml") as f:
    for event in parse_file(f):
        if isinstance(event, HeaderEvent):
            print("header", event.key, event.value)
        elif isinstance(event, BodyLineEvent):
            print("line from the body", event.line)
```

How to get the entire body in a single event:

```python

from mrmime import HeaderEvent, BodyStreamer, body_streamer, parse_file

with open("tests/data/simple.eml") as f:
    for event in body_streamer(parse_file(f)):
        if isinstance(event, HeaderEvent):
            print("header", event.key, event.value)
        elif isinstance(event, BodyStreamer):
            print("body", event.read())
```

How to handle multipart messages:

```python

from mrmime import ParserStateEvent, HeaderEvent, BodyLineEvent, multipart, parse_file

with open("tests/data/simple.eml") as f:
    for event in multipart(parse_file(f)):
        if isinstance(event, ParserStateEvent) and event.state is ParserState.Boundary:
            print("new boundary started")
        elif isinstance(event, HeaderEvent):
            print("header", event.key, event.value)
        elif isinstance(event, BodyLineEvent:
            print("body", event.read())
```

How to handle messages from something other than a file:

```python

from mrmime import BodyStreamer, HeaderEvent, Parser

parser = Parser()

for chunk in get_data_from_source():  # e.g. an async library or something
    for event in parser.feed(chunk):
        if isinstance(event, HeaderEvent):
            print("header", event.key, event.value)
        elif isinstance(event, BodyStreamer):
            print("body", event.read())
```

## TODO
 - Think about recursive parsing, e.g. what if I want to parse messages in messages? What if I want to decide dynamically, rather than prior?
 - MimePart should be decoding the data inside, but have the option to not do that
 - Think more about the state transitions, they're messy
 - we return bytes for everything at the moment, we shouldn't. We could make the Header object do the decoding so that it's lazy, that's a good idea.
 - Can we use memoryviews at all for the headers?