Skip to main content

No project description provided

Project description

TraceSQL Python Package

The tracesql Python is client for TraceSQL. It allows you to easily analyze SQL code for data lineage.

Features

  • Connects to TraceSQL API.
  • Analyzes SQL code to generate data lineage.
  • Outputs the lineage in JSON format.
  • Generates an SVG image of the lineage.

Installation

You can install the tracesql package via pip:

pip install tracesql

Usage

Simple example

from tracesql import analyze_lineage

code = """
CREATE TABLE active_customers AS
SELECT customer_id, first_name || ' ' || last_name as fullname, email
FROM customers
WHERE status = 'active';
"""
response = analyze_lineage(code)

# Save the SVG image of the lineage
with open("image.svg", "w") as fw:
    fw.write(response.svg)

# Save the lineage data in JSON format
with open("lineage.json", "w") as fw:
    fw.write(response.lineage.model_dump_json(indent=2))

print("Lineage successfully saved in files.")

Here is output for this example: simple

Parameters

  • query (str): The SQL query whose lineage you want to analyze.
  • db_model (DbModel): The database model containing the tables and columns used in the SQL query.

Response

  • svg: A string representing the SVG image of the lineage.
  • lineage: An object containing the lineage data in a pydantic class.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tracesql-0.1.7.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

tracesql-0.1.7-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file tracesql-0.1.7.tar.gz.

File metadata

  • Download URL: tracesql-0.1.7.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for tracesql-0.1.7.tar.gz
Algorithm Hash digest
SHA256 90caf9a7125d6619ba802c698c8d702a65ac3a9c1c2974bcea645ba82278a9fe
MD5 462fc9f194c690b3af3a9739fd16e6e5
BLAKE2b-256 565a43ccb726aea70ad053821a4ca33b509c8cfd769923d582f6ee959758dd92

See more details on using hashes here.

File details

Details for the file tracesql-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: tracesql-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for tracesql-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5d97687bba9a4f7c4d8e8c6820318771eaa91fff7340c7cee4a8b2870a896193
MD5 4d4ae2d22e847400065bd5d508d3020b
BLAKE2b-256 81eedee112758e2a93e44db4c8b603973dde179769b29659a7147362b9eee255

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page