For AI agents: the complete documentation index is available at https://docs.dataplatform.ovh.net/ja/llms.txt, the full documentation bundle is available at https://docs.dataplatform.ovh.net/ja/llms-full.txt, and this page is available as Markdown at https://docs.dataplatform.ovh.net/ja/developers-python-sdk-quick-start-source.md.
  • 🇯🇵 日本語
  • Connectors ソースから直接ファイルを取得するカスタムアクション

    この例では、Connectors ソースから直接ファイルを取得し、処理して処理済みデータをLakehouse Managerテーブルに格納する方法を説明します

    目的

    この例では、Connectors ソースから直接ファイルを取得し、処理して処理済みデータをLakehouse Managerテーブルに格納する方法を説明します。

    このコードはカスタムアクションのコンテキストで記述されており、chicago_filesソースをはじめにチュートリアルから使用しています。チュートリアルを実施した場合は、以下のコードをコピーして貼り付けるだけでテストできます。それ以外の場合は、テーブルやデータソースに合わせてコードを適応させる必要があります。

    Tip

    これは、FTPDropboxなどのSourceプロトコルでも動作します。

    import sys
    from forepaas.dwh.connect import connect
    from forepaas.dwh import bulk_insert
    import logging
    
    logger = logging.getLogger(__name__)
    
    def customfunc(event):
        try:
            # here we are connecting to a source named 'chicago_files'
            source_address = "dwh/chicago_files_artur/"
    
            # specify unsupported filename from list of files in source
            filename_w_extension = "stations_rides.csv"
    
            # connect to to file to get the address 
            source_file_connector = connect(source_address + filename_w_extension) 
    
            # connect to file directly
            file_address = source_file_connector.get()
            file_connector = connect(file_address) 
    
            # Extract and treat the file so it is usable
            df = file_connector.extract(return_type='dataframe') 
    
            # Treat the data
            # - - - - 
    
            # connect to the Lakehouse Manager
            dm_connector = connect("dwh/default_dataset/")
    
            # insert into an existing destination table
            stats = bulk_insert(dm_connector, "chicago_calendar_full", df) 
    
            logger.info(stats)
    
            # disconnect from datastore and remote source
            del source_connector
            del dm_connector
    
        except Exception as err:
                raise Exception(f"err:{err} L:{sys.exc_info()[2].tb_lineno}")

    さらに詳しく

    当社のソリューションを実装するためのトレーニングや技術サポートが必要な場合は、営業担当者にお問い合わせください、またはこのリンクをクリックして見積もりを依頼し、プロフェッショナルサービスの専門家にプロジェクトのカスタム分析を依頼してください。

    専用DiscordチャネルでData Platformを構築するチームと直接質問したり、フィードバックを送信したり、交流したりしてください。

    OVHcloudサービスについてサポートが必要な場合は、ヘルプセンターでリクエストを作成してください。

    ユーザーコミュニティに参加してください。