Skip to content

Add URL parameter substitution for iframe embedding #28

Description

@ankitsejwal

Description

When embedding pgweb in iframes, users need to pass tenant-specific parameters (like gsr_client, gsr_inst) that should be automatically substituted into SQL queries without prompting the user.

Current Behavior

  • Queries with @parameter placeholders always prompt users for input
  • No way to pre-populate parameters from URL query strings
  • Makes iframe embedding less seamless for tenant-aware applications

Desired Behavior

  • Extract URL parameters matching patterns like gsr_*, tenant_*, user_* from query string
  • Automatically substitute @parameter placeholders with URL values
  • Only prompt users if no matching URL parameters are available (backward compatibility)
  • Secure parameter handling with SQL injection protection

Use Case

// React iframe with tenant parameters
<iframe
  src={`/sql/embed/?gsr_client=${clientId}&gsr_inst=${instanceId}`}
  title="Database Interface"
/>

Queries like:

SELECT * FROM intf_automation.hubs 
WHERE gsr_client = @gsr_client AND gsr_inst = @gsr_inst

Should automatically substitute without user prompts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions