id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
27,020
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,021
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,022
from mage_ai.data_cleaner.transformer_actions.spark.constants import ( COLUMN_TYPE_MAPPING, GROUP_MOD_COLUMN, ROW_NUMBER_COLUMN, ROW_NUMBER_LIT_COLUMN, ) from mage_ai.data_cleaner.transformer_actions.utils import clean_column_name from pyspark.sql import functions as F from pyspark.sql.functions import ...
null
27,023
import numpy as np from mage_ai.data_cleaner.column_types.constants import ColumnType from mage_ai.data_cleaner.shared.utils import parse_list from mage_ai.data_cleaner.transformer_actions.constants import ActionType, VariableType class ColumnType(str, Enum): CATEGORY = 'category' CATEGORY_HIGH_CARDINALITY = '...
null
27,024
import numpy as np from mage_ai.data_cleaner.column_types.constants import ColumnType from mage_ai.data_cleaner.shared.utils import parse_list from mage_ai.data_cleaner.transformer_actions.constants import ActionType, VariableType def drop_na(df): return df.replace(r'^\s*$', np.nan, regex=True).dropna()
null
27,025
import numpy as np from mage_ai.data_cleaner.column_types.constants import ColumnType from mage_ai.data_cleaner.shared.utils import parse_list from mage_ai.data_cleaner.transformer_actions.constants import ActionType, VariableType class ActionType(str, Enum): ADD = 'add' AVERAGE = 'average' CLEAN_COLUMN_NA...
null
27,026
from mage_ai.data_cleaner.transformer_actions.constants import VariableType import re class VariableType(str, Enum): FEATURE = 'feature' FEATURE_SET = 'feature_set' FEATURE_SET_VERSION = 'feature_set_version' The provided code snippet includes necessary dependencies for implementing the `interpolate` func...
text: string to operate on key: key to search within text variable_data: dictionary containing data used to interpolate
27,027
from mage_ai.data_cleaner.transformer_actions.constants import VariableType import re def replace_true_false(action_code): regex_pattern_true = re.compile(' true') regex_pattern_false = re.compile(' false') return re.sub( regex_pattern_true, ' True', re.sub(regex_pattern_false, ' F...
null
27,028
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,029
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,030
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,031
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,032
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,033
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,034
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,035
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,036
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,037
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,038
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,039
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,040
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,041
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,042
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,043
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,044
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,045
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,046
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,047
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,048
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,049
from mage_ai.data_cleaner.column_types.column_type_detector import find_syntax_errors from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES, ColumnType from mage_ai.data_cleaner.estimators.outlier_removal import OutlierRemover from mage_ai.data_cleaner.transformer_actions.action_code import query_with_ac...
null
27,050
from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES from mage_ai.data_cleaner.transformer_actions.action_code import query_with_action_code from mage_ai.data_cleaner.transformer_actions.custom_action import execute_custom_action import pandas as pd def execute_custom_action(df, action, **kwargs): ...
null
27,051
from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES from mage_ai.data_cleaner.transformer_actions.action_code import query_with_action_code from mage_ai.data_cleaner.transformer_actions.custom_action import execute_custom_action import pandas as pd def drop_duplicates(df, action, **kwargs): keep =...
null
27,052
from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES from mage_ai.data_cleaner.transformer_actions.action_code import query_with_action_code from mage_ai.data_cleaner.transformer_actions.custom_action import execute_custom_action import pandas as pd def query_with_action_code(df, action_code, kwargs): ...
df: Pandas DataFrame action: TransformerAction serialized into a dictionary
27,053
from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES from mage_ai.data_cleaner.transformer_actions.action_code import query_with_action_code from mage_ai.data_cleaner.transformer_actions.custom_action import execute_custom_action import pandas as pd NUMBER_TYPES = frozenset([ColumnType.NUMBER, ColumnTy...
null
27,054
from mage_ai.data_cleaner.column_types.constants import NUMBER_TYPES from mage_ai.data_cleaner.transformer_actions.action_code import query_with_action_code from mage_ai.data_cleaner.transformer_actions.custom_action import execute_custom_action import pandas as pd def remove_row(df, action, **kwargs): row_indices...
null
27,055
import os import shutil import uuid from typing import List, Optional, Tuple from cryptography.fernet import Fernet, InvalidToken from mage_ai.data_preparation.models.project import Project from mage_ai.orchestration.constants import Entity from mage_ai.orchestration.db import safe_db_query from mage_ai.settings.repo i...
null
27,056
import os import shutil import uuid from typing import List, Optional, Tuple from cryptography.fernet import Fernet, InvalidToken from mage_ai.data_preparation.models.project import Project from mage_ai.orchestration.constants import Entity from mage_ai.orchestration.db import safe_db_query from mage_ai.settings.repo i...
null
27,057
import os import shutil import uuid from typing import List, Optional, Tuple from cryptography.fernet import Fernet, InvalidToken from mage_ai.data_preparation.models.project import Project from mage_ai.orchestration.constants import Entity from mage_ai.orchestration.db import safe_db_query from mage_ai.settings.repo i...
null
27,058
import os import shutil import uuid from typing import List, Optional, Tuple from cryptography.fernet import Fernet, InvalidToken from mage_ai.data_preparation.models.project import Project from mage_ai.orchestration.constants import Entity from mage_ai.orchestration.db import safe_db_query from mage_ai.settings.repo i...
This method still only returns secrets for the current repo. This will need to be updated in the future to return secrets based on the parameters passed in.
27,059
import os import shutil import uuid from typing import List, Optional, Tuple from cryptography.fernet import Fernet, InvalidToken from mage_ai.data_preparation.models.project import Project from mage_ai.orchestration.constants import Entity from mage_ai.orchestration.db import safe_db_query from mage_ai.settings.repo i...
Calls get_secret_value only if the db has already been initialized.
27,060
import os import shutil import uuid from typing import List, Optional, Tuple from cryptography.fernet import Fernet, InvalidToken from mage_ai.data_preparation.models.project import Project from mage_ai.orchestration.constants import Entity from mage_ai.orchestration.db import safe_db_query from mage_ai.settings.repo i...
null
27,061
import os from datetime import datetime from typing import Any, Dict, List import pandas as pd from mage_ai.data_cleaner.shared.utils import is_geo_dataframe, is_spark_dataframe from mage_ai.data_preparation.models.variable import ( VARIABLE_DIR, Variable, VariableType, ) from mage_ai.data_preparation.repo_...
Set global variable by key. Global variables are stored together with project's code.
27,062
import os from datetime import datetime from typing import Any, Dict, List import pandas as pd from mage_ai.data_cleaner.shared.utils import is_geo_dataframe, is_spark_dataframe from mage_ai.data_preparation.models.variable import ( VARIABLE_DIR, Variable, VariableType, ) from mage_ai.data_preparation.repo_...
Delete global variable by key. Global variables are stored together with project's code.
27,063
from os import path from pandas import DataFrame from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.algolia import Algolia def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retr...
Template to export data into Algolia.
27,064
from os import path from pandas import DataFrame from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.weaviate import Weaviate def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Re...
Template to export data to Weaviate.
27,065
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.snowflake import Snowflake from pandas import DataFrame from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ ...
Template for exporting data to a Snowflake warehouse. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#snowflake
27,066
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.mssql import MSSQL from pandas import DataFrame from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve...
Template for exporting data to a MSSQL database. Specify your configuration settings in 'io_config.yaml'. Set the following in your io_config: Docs: https://docs.mage.ai/integrations/databases/MicrosoftSQLServer
27,067
from mage_ai.io.file import FileIO from pandas import DataFrame class FileIO(BaseFile): """ Handles data transfer between the filesystem and the Mage app. """ def load( self, filepath: Union[str, os.PathLike] = None, format: Union[FileFormat, str, None] = None, file_dir...
Template for exporting data to filesystem. Docs: https://docs.mage.ai/design/data-loading#fileio
27,068
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.redshift import Redshift from pandas import DataFrame from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Re...
Template for exporting data to a Redshift cluster. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#redshift
27,069
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.google_cloud_storage import GoogleCloudStorage from pandas import DataFrame from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) ...
Template for exporting data to a Google Cloud Storage bucket. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#googlecloudstorage
27,070
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.mysql import MySQL from pandas import DataFrame from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve...
Template for exporting data to a MySQL database. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#mysql
27,071
from mage_ai.settings.repo import get_repo_path from mage_ai.io.azure_blob_storage import AzureBlobStorage from mage_ai.io.config import ConfigFileLoader from pandas import DataFrame from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> s...
Template for exporting data to a Azure Blob Storage. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading
27,072
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.google_sheets import GoogleSheets from pandas import DataFrame from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: "...
Template for exporting data to a worksheet in a Google Sheet. Specify your configuration settings in 'io_config.yaml'. Sheet Name or ID may also be used instead of URL sheet_id = "your_sheet_id" sheet_name = "your_sheet_name" Worksheet position or name may also be specified worksheet_position = 0 worksheet_name = "your...
27,073
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.s3 import S3 from pandas import DataFrame from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the r...
Template for exporting data to a S3 bucket. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#s3
27,074
from os import path from pandas import DataFrame from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.mongodb import MongoDB def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retr...
null
27,075
from os import path from pandas import DataFrame from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.chroma import Chroma def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrie...
null
27,076
The provided code snippet includes necessary dependencies for implementing the `export_data_to_s3` function. Write a Python function `def export_data_to_s3(df, **kwargs)` to solve the following problem: Template for exporting data to a S3 bucket. Here is the function: def export_data_to_s3(df, **kwargs): """ ...
Template for exporting data to a S3 bucket.
27,077
from os import path from pandas import DataFrame from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.qdrant import Qdrant def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrie...
Template to write data into Qdrant.
27,078
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.duckdb import DuckDB from pandas import DataFrame from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrie...
Template for exporting data to DuckDB database. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#duckdb
27,079
from mage_ai.settings.repo import get_repo_path from mage_ai.io.bigquery import BigQuery from mage_ai.io.config import ConfigFileLoader from pandas import DataFrame from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Re...
Template for exporting data to a BigQuery warehouse. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#bigquery
27,080
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.postgres import Postgres from pandas import DataFrame from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Re...
Template for exporting data to a PostgreSQL database. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#postgresql
27,081
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.algolia import Algolia from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path base...
Template for loading data from Algolia.
27,082
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.weaviate import Weaviate from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path ba...
Template to load data from Weaviate.
27,083
import io import pandas as pd import requests The provided code snippet includes necessary dependencies for implementing the `load_data_from_api` function. Write a Python function `def load_data_from_api(*args, **kwargs)` to solve the following problem: Template for loading data from API Here is the function: def lo...
Template for loading data from API
27,084
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.snowflake import Snowflake from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path ...
Template for loading data from a Snowflake warehouse. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#example-loading-data-from-snowflake-warehouse
27,085
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.mssql import MSSQL from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path based on...
Template for loading data from a MSSQL database. Specify your configuration settings in 'io_config.yaml'. Set the following in your io_config: Docs: https://docs.mage.ai/integrations/databases/MicrosoftSQLServer
27,086
from mage_ai.io.file import FileIO class FileIO(BaseFile): """ Handles data transfer between the filesystem and the Mage app. """ def load( self, filepath: Union[str, os.PathLike] = None, format: Union[FileFormat, str, None] = None, file_directories: List[str] = None, ...
Template for loading data from filesystem. Load data from 1 file or multiple file directories. For multiple directories, use the following: FileIO().load(file_directories=['dir_1', 'dir_2']) Docs: https://docs.mage.ai/design/data-loading#fileio
27,087
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.redshift import Redshift from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path ba...
Template for loading data from a Redshift cluster. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#redshift
27,088
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.google_cloud_storage import GoogleCloudStorage from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve ...
Template for loading data from a Google Cloud Storage bucket. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#googlecloudstorage
27,089
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.mysql import MySQL from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path based on...
Template for loading data from a MySQL database. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#mysql
27,090
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.azure_blob_storage import AzureBlobStorage from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the ...
Template for loading data from a Azure Blob Storage. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#azureblobstorage
27,091
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.google_sheets import GoogleSheets from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repositor...
Template for loading data from a worksheet in a Google Sheet. Specify your configuration settings in 'io_config.yaml'. Sheet Name or ID may also be used instead of URL sheet_id = "your_sheet_id" sheet_name = "your_sheet_name" Worksheet position or name may also be specified worksheet_position = 0 worksheet_name = "your...
27,092
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.s3 import S3 from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path based on the g...
Template for loading data from a S3 bucket. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#s3
27,093
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.mongodb import MongoDB from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path base...
null
27,094
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.oracledb import OracleDB from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path ba...
Template for loading data from a OracleDB database. Specify your configuration settings in 'io_config.yaml'.
27,095
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.chroma import Chroma from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path based ...
Template for loading data from Chroma.
27,096
The provided code snippet includes necessary dependencies for implementing the `load_from_s3_bucket` function. Write a Python function `def load_from_s3_bucket(**kwargs)` to solve the following problem: Template for loading data from a S3 bucket. Here is the function: def load_from_s3_bucket(**kwargs): """ ...
Template for loading data from a S3 bucket.
27,097
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.qdrant import Qdrant from sentence_transformers import SentenceTransformer from os import path DEFAULT_MODEL = 'all-MiniLM-L6-v2' def get_repo_path( file_path: str = None, root_project: bool = False, ...
Template to load data from Qdrant.
27,098
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.duckdb import DuckDB from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path based ...
Template for loading data from DuckDB database. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#duckdb
27,099
from mage_ai.data_preparation.repo_manager import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.pinot import Pinot from os import path def get_repo_path() -> str: warn( 'repo_manager.get_repo_path is deprecated. Please use mage_ai.settings.repo.get_repo_path', Depreca...
Template for loading data from a Pinot warehouse. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#pinot
27,100
from mage_ai.settings.repo import get_repo_path from mage_ai.io.bigquery import BigQuery from mage_ai.io.config import ConfigFileLoader from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path ba...
Template for loading data from a BigQuery warehouse. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#bigquery
27,101
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.druid import Druid from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path based on...
Template for loading data from a Druid warehouse. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#druid
27,102
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.postgres import Postgres from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path ba...
Template for loading data from a PostgreSQL database. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#postgresql
27,103
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.snowflake import Snowflake from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path ...
Template code for checking the results of a Snowflake query. Specify your configuration settings in 'io_config.yaml'. Return: True if the sensor should complete, False if it should keep waiting
27,104
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.redshift import Redshift from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path ba...
Template code for checking the results of a Redshift query. Specify your configuration settings in 'io_config.yaml'. Return: True if the sensor should complete, False if it should keep waiting
27,105
from mage_ai.orchestration.run_status_checker import check_status def check_status( pipeline_uuid: str, execution_date: datetime, block_uuid: str = None, hours: int = 24, ) -> bool: __validate_pipeline_and_block(pipeline_uuid, block_uuid) execution_date = execution_date.replace(tzinfo=timezone...
Template code for checking if block or pipeline run completed.
27,106
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.google_cloud_storage import GoogleCloudStorage from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve ...
Template code for checking if a file or folder exists in a Google Cloud Storage bucket. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#googlecloudstorage
27,107
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.mysql import MySQL from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path based on...
Template code for checking the results of a MySQL query. Specify your configuration settings in 'io_config.yaml'. Return: True if the sensor should complete, False if it should keep waiting
27,108
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.s3 import S3 from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path based on the g...
Template code for checking if a file or folder exists in a S3 bucket You will also need to fill out the following AWS related fields in `io_config.yaml`: - AWS_ACCESS_KEY_ID - AWS_SECRET_ACCESS_KEY - AWS_REGION
27,109
from mage_ai.settings.repo import get_repo_path from mage_ai.io.bigquery import BigQuery from mage_ai.io.config import ConfigFileLoader from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path ba...
Template code for checking the results of a BigQuery query. Specify your configuration settings in 'io_config.yaml'. Return: True if the sensor should complete, False if it should keep waiting
27,110
from mage_ai.settings.repo import get_repo_path from mage_ai.io.config import ConfigFileLoader from mage_ai.io.postgres import Postgres from os import path def get_repo_path( file_path: str = None, root_project: bool = False, absolute_path: bool = True, ) -> str: """ Retrieve the repository path ba...
Template code for checking the results of a Postgres query. Specify your configuration settings in 'io_config.yaml'. Return: True if the sensor should complete, False if it should keep waiting
27,111
from typing import Dict, List, Mapping, Union from mage_ai.data_integrations.destinations.constants import DESTINATIONS from mage_ai.data_integrations.sources.constants import SOURCES from mage_ai.data_integrations.utils.settings import get_uuid from mage_ai.data_preparation.models.constants import ( BLOCK_LANGUAGE...
null
27,112
from typing import Dict, List def destination(*args, **kwargs) -> str: return {{ data_integration_uuid }} def config(*args, **kwargs) -> Dict: destination: str = kwargs.get('destination', None)
null
27,113
from typing import Callable, Dict, List def source(*args, **kwargs) -> str: return {{ data_integration_uuid }} def config(*args, **kwargs) -> Dict: source: str = kwargs.get('source', None)
null
27,114
from mage_ai.io.file import FileIO from pandas import DataFrame class FileIO(BaseFile): """ Handles data transfer between the filesystem and the Mage app. """ def load( self, filepath: Union[str, os.PathLike] = None, format: Union[FileFormat, str, None] = None, file_dir...
Template for exporting data to filesystem. Docs: https://docs.mage.ai/design/data-loading#example-loading-data-from-a-file
27,115
import io import pandas as pd import requests from pandas import DataFrame The provided code snippet includes necessary dependencies for implementing the `load_data_from_api` function. Write a Python function `def load_data_from_api(**kwargs) -> DataFrame` to solve the following problem: Template for loading data from...
Template for loading data from API
27,116
import io import pandas as pd import requests from pandas import DataFrame The provided code snippet includes necessary dependencies for implementing the `test_output` function. Write a Python function `def test_output(df) -> None` to solve the following problem: Template code for testing the output of the block. Her...
Template code for testing the output of the block.
27,117
from pandas import DataFrame import math def select_number_columns(df: DataFrame) -> DataFrame: return df[['Age', 'Fare', 'Parch', 'Pclass', 'SibSp', 'Survived']] def fill_missing_values_with_median(df: DataFrame) -> DataFrame: for col in df.columns: values = sorted(df[col].dropna().tolist()) me...
Template code for a transformer block. Add more parameters to this function if this block has multiple parent blocks. There should be one parameter for each output variable from each parent block. Args: df (DataFrame): Data frame from parent block. Returns: DataFrame: Transformed data frame
27,118
from pandas import DataFrame import math The provided code snippet includes necessary dependencies for implementing the `test_output` function. Write a Python function `def test_output(df) -> None` to solve the following problem: Template code for testing the output of the block. Here is the function: def test_outpu...
Template code for testing the output of the block.
27,119
def on_success_callback(**kwargs): pass
null