Can you give me a simple example of getting MySQL records from a table, and storing them into MongoDB collection?
import brewery
import brewery.ds as ds
import brewery.metadata as metadata
from sqlalchemy import Table, Column, Integer, String, Text, DateTime, ForeignKey
from sqlalchemy import create_engine, MetaData
engine = create_engine(
"postgresql://postgres@localhost/abc"
)
metadata = MetaData(engine)
# fields = metadata.FieldList(["articulo", "titulo"])
stream = ds.SQLDataSource(connection=engine, table="articulos", schema="abc")
print stream.fields
target = ds.MongoDBDataTarget(collection="articulos",
database="test_database")
for row in stream.records():
print "Appending row " + str(row)
target.append(row)
I have noticed that examples are very sparse and that documentation is grammatically wrong and missing. Good opportunity for patches, I guess. :)