blob: c20a79b011e1041ba13bd87c068304d0da01cfcb [file] [log] [blame]
:py:mod:`airflow.providers.google.cloud.transfers.mssql_to_gcs`
===============================================================
.. py:module:: airflow.providers.google.cloud.transfers.mssql_to_gcs
.. autoapi-nested-parse::
MsSQL to GCS operator.
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.google.cloud.transfers.mssql_to_gcs.MSSQLToGCSOperator
.. py:class:: MSSQLToGCSOperator(*, mssql_conn_id='mssql_default', **kwargs)
Bases: :py:obj:`airflow.providers.google.cloud.transfers.sql_to_gcs.BaseSQLToGCSOperator`
Copy data from Microsoft SQL Server to Google Cloud Storage
in JSON, CSV or Parquet format.
:param mssql_conn_id: Reference to a specific MSSQL hook.
**Example**:
The following operator will export data from the Customers table
within the given MSSQL Database and then upload it to the
'mssql-export' GCS bucket (along with a schema file). ::
export_customers = MsSqlToGoogleCloudStorageOperator(
task_id='export_customers',
sql='SELECT * FROM dbo.Customers;',
bucket='mssql-export',
filename='data/customers/export.json',
schema_filename='schemas/export.json',
mssql_conn_id='mssql_default',
gcp_conn_id='google_cloud_default',
dag=dag
)
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:MSSQLToGCSOperator`
.. py:attribute:: ui_color
:annotation: = #e0a98c
.. py:attribute:: type_map
.. py:method:: query()
Queries MSSQL and returns a cursor of results.
:return: mssql cursor
.. py:method:: field_to_bigquery(field)
Convert a DBAPI field to BigQuery schema format.
.. py:method:: convert_type(value, schema_type, **kwargs)
:classmethod:
Takes a value from MSSQL, and converts it to a value that's safe for
JSON/Google Cloud Storage/BigQuery.
Datetime, Date and Time are converted to ISO formatted strings.