allow-materialize-ips.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 1. In the [SQL Shell](https://console.materialize.com/), or your preferred SQL
  2. client connected to Materialize, use the [`CREATE SECRET`](/sql/create-secret/)
  3. command to securely store the password for the SQL Server role you'll use to
  4. replicate data into Materialize:
  5. ```mzsql
  6. CREATE SECRET sqlserver_pass AS '<PASSWORD>';
  7. ```
  8. 1. Use the [`CREATE CONNECTION`](/sql/create-connection/) command to create a
  9. connection object with access and authentication details for Materialize to
  10. use:
  11. ```mzsql
  12. CREATE CONNECTION sqlserver_connection TO SQL SERVER (
  13. HOST <host>,
  14. PORT 1433,
  15. USER 'materialize',
  16. PASSWORD SECRET sqlserver_pass,
  17. DATABASE <database>,
  18. SSL MODE 'require'
  19. );
  20. ```
  21. - Replace `<host>` with your SQL Server endpoint, and `<database>` with the database you'd like to connect to.
  22. 1. Use the [`CREATE SOURCE`](/sql/create-source/) command to connect Materialize
  23. to your SQL Server instance and start ingesting data:
  24. ```mzsql
  25. CREATE SOURCE mz_source
  26. FROM SQL SERVER CONNECTION sqlserver_connection
  27. FOR ALL TABLES;
  28. ```
  29. - By default, the source will be created in the active cluster; to use a
  30. different cluster, use the `IN CLUSTER` clause.
  31. - To ingest data from specific tables use the `FOR TABLES
  32. (<table1>, <table2>)` options instead of `FOR ALL TABLES`.
  33. - To handle unsupported data types, use the `TEXT COLUMNS` or `EXCLUDE
  34. COLUMNS` options. Check out the [reference documentation](/sql/create-source/sql-server/#supported-types)
  35. for guidance.
  36. 1. After source creation, you can handle upstream [schema changes](/sql/create-source/sql-server/#schema-changes)
  37. by dropping and recreating the source.