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 4091956
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:25:53+00:00 2026-05-20T19:25:53+00:00

I developed a web platform in PHP a year ago, and I was kinda

  • 0

I developed a web platform in PHP a year ago, and I was kinda proud of the data access layer I wrote for it. Since then, I started re-using the same concept over and over. But now I’m thinking to take it to the next level, instead of re-writing the whole database access code I’d like to create a tool that will parse my SQL schema and generate the DAL classes by itself.

The information needed from the SQL schema in order to generate the code is:

* Tables
* Fields
* Fields types
* Foreign keys

Indeed, I looked up for some SQL parser and found some stuff but I ended up by deciding to do this differently. Instead of generating the code from the SQL schema itself, I’d generate it from a meta data that I’d create according to the database real schema.

I thought of something like:

TableName[
   FieldA : Type;
   FieldB:  Type;
]
TableName2[
   FieldA : Type, FK(TableName.FieldA);
   FieldZ:  Type;
]

This is not a spec at all, it’s just a quick thinking result that says what kind of stuff I’d like to achieve.

The question now is:
Does python have some built-in API, or maybe some 3rd party library I could use to parse some format that’d let me define my schema as stated above?
I don’t want to reinvent the wheel, and I’m not interested at all in writing my own parser, all I want is getting a basic and working tool ASAP.

Thanks

  • 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. Editorial Team
    Editorial Team
    2026-05-20T19:25:54+00:00Added an answer on May 20, 2026 at 7:25 pm

    The immitiate thought would be to simply use regular python syntax to define your tables:

    {
        'TableName': {'FieldA': ['Type', FK(..)], 'FieldB': ['type']}
    }
    

    and so on.

    You could however have a look at how django does it: you define a class and add properties to that class, which will then represent your model. This model can then be used to generate the SQL statements, and is also valid – and easily extendable – Python code.

    Other suggestions could be to use a JSON structure to represent your data, and then write some code to parse that one. This would be similar to using the existing python syntax, but would be easier to parse in other languages (the example given above would be almost valid JSON syntax out of the box (replace ‘ with “).

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

Sidebar

Related Questions

A few years ago I developed a web app for which we wanted to
I developed a web application using phone gap framework for android platform. I only
Has anyone developed an abstraction layer above Amazon Web Services and the Google App
I've never developed a web application that uses distributed memory. Is it common practice
I've developed a web service in asp.net and am able to test it from
I have a web application developed with ASP.net and C# that is running on
I have a web project that I developed where one of the main functions
We provide a web application with a frontend completely developed in Adobe Flash. When
I have two web applications and both are developed in ASP.NET. Now I want
I have created a web service which has a couple of methods developed using

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.