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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:43:15+00:00 2026-05-18T06:43:15+00:00

is there any efficient and easy way to execute statements similar to: CREATE TABLE

  • 0

is there any efficient and easy way to execute statements similar to:

CREATE TABLE IF NOT EXISTS fubar ( id int, name varchar(80))

for columns as you perform insert statements.

I’d imagine it will be a lot more complicated, but just for the sake of explanation, i guess I’m looking for something like….

IF NOT EXISTS
(
  SELECT * FROM information_schema.COLUMNS
  WHERE 
    COLUMN_NAME='new_column' AND 
    TABLE_NAME='the_table' AND 
    TABLE_SCHEMA='the_schema'
)
THEN
  ALTER TABLE `the_schema`.`the_table`
  ADD COLUMN `new_column` bigint(20) unsigned NOT NULL default 1;

alternatively, is there a way a python library that might handle the process?

basically, i want the ‘id’s’ of a ‘dictionary’ to define the columns, and create them if they do not already exist.

i also would like the database to stay reasonably efficient, so i guess some dynamic handling of the type of data would also be necessary?

just wondering if anything like this exists at the moment, and if not looking for advice on how best to achieve it….

  • 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-18T06:43:15+00:00Added an answer on May 18, 2026 at 6:43 am

    I believe that you’re looking for an Object Relational Mapping system.

    For Python there are a couple available:

    • SQLAlchemy: http://www.sqlalchemy.org/
    • SQLObject: http://sqlobject.org/

    Or if you’re building a website, the Django project includes an ORM system: http://www.djangoproject.com/

    To simplify the process, you can add something like Elixir on top of SQLAlchemy: http://elixir.ematia.de/trac/wiki

    You would get code like this:

    class Movie(Entity):
        title = Field(Unicode(30))
        year = Field(Integer)
        description = Field(UnicodeText)
    

    This is how to insert:

    >>> Movie(title=u"Blade Runner", year=1982)
    <Movie "Blade Runner" (1982)>
    >>> session.commit()
    

    Or fetch the results:

    >>> Movie.query.all()
    [<Movie "Blade Runner" (1982)>]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way we could do efficient paging with petapoco and mvc3. At
Is there any easy reasonable/feasible way to efficiently pipeline results from the database? I
Is there any easy way to move the records up and down using PHP.
I know there must an easy and efficient way to do this. I have
Are there any efficient bitwise operations I can do to get the number of
Is there any more efficient,cleaner and shorter form for following: if($x==null or $y==null or
Is there any speed- and cache-efficient implementations of trie in C/C++? I know what
Is there any time in which a reference type is more efficient than a
Is there any way in Notepad++ (or even with another tool) to change the
Is there any way I can set a formatter on models that will convert

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.