Doltpy

Latest version: v2.0.14

Safety actively analyzes 688587 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 5 of 5

1.0.0

`doltpy.core`
We now support an interface much closer to the CLI, in particular we attempt to match objects on the `Dolt` class to the name of commands at the `CLI`. Some examples:

def init_new_repo(...):

is now:

class Dolt:

staticmethod
def init(...):


We also removed utility functions like `import_df`, and broke them out into a sub-module dedicated to writing.

`doltpy.core.write`
In an effort to properly separate concerns, we wanted to keep `dolt.core` purely for replicating the CLI, so any workflows that you define ad-hoc can be scripted without much translation effort. We also realized that just files and `pd.DataFrame` based loaders was a bit restrictive, and per 15 we added support for lists of dicts, and dicts of lists, for row and column based imports. These methods will attempt to infer a schema in `create` mode, and update an existing table in `updated` mode.

Other functionality remains the same, and we are going to be aggressively investing in this API going forward to make getting Dolt into production Python code a breeze. We'd be grateful for bug reports and feature requests.

0.1.2

We are excited to release 0.1.2 of Doltpy. There are two main changes in this release:
- we made a slight tweak to the API to make it easier to work with
- we added support for bi-directional sync with Postgres instances

We have now successfully provided a simple API for interfacing between Dolt, and Postgres or MySQL. That means you can use Dolt to version and maintain valuable data, and then sync into your production system. Alternatively, you can use Dolt to version data that is stored in Postgres and MySQL.

Here is a simple example of syncing to a Postgres host:
python
import psycopg2
from doltpy.core import Dolt
from doltpy.etl.sql_sync import sync_from_dolt, get_dolt_source_reader, get_dolt_table_reader_diffs, get_postgres_target_writer

repo = Dolt('path/to/repo')
conn_str = "host='{host}' port='{port}' dbname='{dbname}' user='{user}' password='{password}'".format(
host=host,
port=port,
dbname=db,
user=user,
password=password
)
conn = psycopg2.connect(conn_str)
target_writer = get_postgres_target_writer(conn, True)
source_reader = get_dolt_source_reader(repo, get_dolt_table_reader_diffs())
sync_from_dolt(source_reader, target_writer, {'table': 'table'})


And syncing to Dolt from a Postgres host:
python
import psycopg2
from doltpy.core import Dolt
from doltpy.etl.sql_sync import sync_from_dolt, get_postgres_source_reader, get_postgres_table_reader, get_dolt_target_writer

repo = Dolt('path/to/repo')
conn_str = "host='{host}' port='{port}' dbname='{dbname}' user='{user}' password='{password}'".format(
host=host,
port=port,
dbname=db,
user=user,
password=password
)
conn = psycopg2.connect(conn_str)
target_writer = get_dolt_target_writer(repo, commit=True)
source_reader = get_postgres_source_reader(conn, get_postgres_table_reader())
sync_to_dolt(source_reader, target_writer, {'table': 'table'})


We have heard loud and clear from users and potential customers that Dolt needs to interoperate with existing relational database solutions, and this is our first attempt to solve this problem. As always we appreciate questions and bug reports in the issues on the Doltpy project.

0.1.0

`doltpy.core`
`Dolt` no longer has a field `cnx`, instead user must request a connection to the server via `get_connection(...)`, which returns a connection to the server if it is running.

`doltpy.etl.sql_sync`
Today we are releasing an alpha version of our SQL Sync toolchain for integrating Dolt with existing relational databases. This tooling requires selecting a reader, a writer, providing location of Dolt repo, and connection to a target database. The code might look something like this:
python
import mysql.connector as connector
from doltpy.core import Dolt
from doltpy.etl.sql_sync import DoltSync, get_mysql_target_writer, get_dolt_source_reader, get_dolt_table_reader_diffs

mysql_conn = connector.connect(host='host', user='user', password='password', database='mydb')
dolt_repo = Dolt('/path/to/repo')
table_mapping = {'my_table': 'my_table'}
target_writer = get_mysql_target_writer(mysql_conn)
source_reader = get_source_reader(dolt_repo, get_table_reader_diffs())
dolt_to_mysql_sync = DoltSync(source_reader, target_writer, table_mapping)
dolt_to_mysql_sync.sync()


Please create an issue if you find any bugs. This codebase is under active development and we are keen to hear from potential users who see value in versioning data.

0.0.9

Fix download link and dependency.

0.0.8

Patch an issue introduced in a function call that is outside test coverage.

0.0.7

Bug fixes and improvements.

Page 5 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.