Skip to content

Copytomongodb

flowtask.components.CopyToMongoDB

CopyToMongoDB

CopyToMongoDB(loop=None, job=None, stat=None, **kwargs)

Bases: CopyTo, PandasDataframe

CopyToMongo.

Overview This component allows copying data into a MongoDB collection, using write functionality from AsyncDB MongoDB driver.

.. table:: Properties :widths: auto

+--------------+----------+-----------+--------------------------------------------+ | Name | Required | Summary | +--------------+----------+-----------+--------------------------------------------+ | tablename | Yes | Name of the collection in | | | | MongoDB | +--------------+----------+-----------+--------------------------------------------+ | schema | Yes | Name of the database | | | | where the collection is located | +--------------+----------+-----------+--------------------------------------------+ | truncate | Yes | If true, the collection will be emptied | | | | before copying new data | +--------------+----------+-----------+--------------------------------------------+ | use_buffer | No | When activated, optimizes performance | | | | for large volumes of data | +--------------+----------+-----------+--------------------------------------------+ | key_field | No | Field to use as unique identifier | | | | for upsert operations | +--------------+----------+-----------+--------------------------------------------+

Example:

```yaml
CopyToMongoDB:
  schema: hisense
  tablename: product_availability
  dbtype: documentdb
```

default_connection

default_connection()

default_connection. Default Connection to MongoDB.

get_connection

get_connection(driver='mongo', dsn=None, params=None, **kwargs)

Useful for internal connections of QS.