Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 125833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:13:18+00:00 2026-05-11T05:13:18+00:00

I have been wondering whether there is any code out there that enables representing

  • 0

I have been wondering whether there is any code out there that enables representing SQL in the form of some object tree that can be assembled, modified and then finally rendered to valid SQL?

Off the top of my head it could look something like that…

var stmnt = new Statement(); stmnt   .AddMaster('Customer')   .Show('Firstname, 'Lastname')   .AddJoin('Address', 'ID', 'CustomerID')   .Show('Street', 'City'); stmnt.WhereStatement()   .AddParameter('Address.City', Op.Equal);  string sql = stmnt.Generate(); // select a.FirstName, a.LastName, b.Street, b.City // from Customer a // join Address b on b.CustomerID = a.ID // where b.City = :p1 

This is just an example and the thing out there may work totally different, but yes, I’d love to hear what is out tere in that respect.

UPDATE:

I am aware of the numerous possibilities of using ORM technologies to get my results from the DB, but I was after a model for the SQL itself. I know that the level of abstraction is pretty low, but it could possibly allow a situation where multiple collaborators can work on an SQL statement (multiple joins, multiple wheres) which can then be ‘rendered’ at the end of the build-Phase.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:13:19+00:00Added an answer on May 11, 2026 at 5:13 am

    The python package SQLAlchemy has an ORM layer, but it also has an SQL generation layer.

    [I realise you tagged this post c# and .net, but I thought you might like to see what else is out there]

    Here is some example code:

    from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey from sqlalchemy.sql import select  metadata = MetaData()  # Make a basic customer table. Customer = Table('Customer',                  metadata,                  Column('ID', Integer, primary_key=True),                  Column('FirstName', String),                  Column('LastName', String))  # Make a basic address table Address = Table('Address',                 metadata,                 Column('ID', Integer, primary_key=True),                 Column('City', String),                 Column('Street', String),                 Column('CustomerID', None, ForeignKey('Customer.ID')))   # Generate some sql stmt = select([Customer.c.FirstName,                Customer.c.LastName,                Address.c.Street,                Address.c.City],               from_obj=Customer.join(Address),               whereclause=Address.c.City == 'Wellington')  # Display print stmt # output: SELECT 'Customer'.'FirstName', 'Customer'.'LastName', 'Address'.'Street', 'Address'.'City'  FROM 'Customer' JOIN 'Address' ON 'Customer'.'ID' = 'Address'.'CustomerID'  WHERE 'Address'.'City' = :City_1  # note that SQLAlchemy picked up the join condition from the foreign key. # you can specify other join conditions if you want. 

    Typically, you would execute the statement by using SQLAlchemy to connect to a database. Then you can do:

    for row in stmt.execute():     print 'Name:', row.c.FirstName, row.c.LastName, 'City:', row.c.City 

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 247k
  • Answers 247k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer So I'm wondering if there is a Java library that… May 13, 2026 at 8:38 am
  • Editorial Team
    Editorial Team added an answer There is a Fluid 960 Grid System too. May 13, 2026 at 8:38 am
  • Editorial Team
    Editorial Team added an answer A few things come to mind: Why can't your end-user… May 13, 2026 at 8:38 am

Related Questions

I'm taking on the re-architecting of a pair of applications which use Hibernate in
Are there any tools available for transforming types defined in an xsd schema (may
Class names have been changed to protect the innocent . If I have an
Everyone is saying how .NET Remoting is being replaced by WCF, but I'm wondering

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.