generated from ydataai/opensource-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: conn datasource creation (#156)
* fix: connector and datasource creation * chore: add code example for SDK * fix(linting): code formatting * fix: connector creation and synthesizer get from api request. * fix(linting): code formatting * fix: fix linting * fix: fix status and metrics to create synths from existing DS. * fix(linting): code formatting * fix: fix typeguard version * fix: remove unused code. --------- Co-authored-by: Azory YData Bot <[email protected]>
- Loading branch information
1 parent
91616da
commit ec77c29
Showing
10 changed files
with
71 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
|
||
from ydata.sdk.datasources import DataSource | ||
from ydata.sdk.synthesizers import RegularSynthesizer | ||
|
||
# Authenticate to Fabric to leverage the SDK - https://docs.sdk.ydata.ai/latest/sdk/installation/ | ||
# Make sure to add your token as env variable. | ||
os.environ["YDATA_TOKEN"] = '{insert-token}' # Remove if already defined | ||
|
||
|
||
# In this example, we demonstrate how to train a synthesizer from an existing RDBMS Dataset. | ||
# Make sure to follow the step-by-step gu ide to create a Dataset in Fabric's catalog: https://docs.sdk.ydata.ai/latest/get-started/create_multitable_dataset/ | ||
X = DataSource.get('{insert-datasource-id}') | ||
|
||
# Init a multi-table synthesizer. Provide a connector so that the process of data synthesis write the | ||
# synthetic data into the destination database | ||
# Provide a connector ID as the write_connector argument. See in this tutorial how to get a connector ID | ||
synth = RegularSynthesizer(name='existing_DS') | ||
|
||
# Start the training of your synthetic data generator | ||
synth.fit(X) | ||
|
||
# As soon as the training process is completed you are able to sample a synthetic database | ||
# The input expected is a percentage of the original database size | ||
# In this case it was requested a synthetic database with the same size as the original | ||
# Your synthetic sample was written to the database provided in the write_connector | ||
synth.sample(n_samples=1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters