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

  • Home
  • SEARCH
  • 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 9020899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:07:50+00:00 2026-06-16T05:07:50+00:00

The situation is a little bit simplified. I have two migration files for sqlalchemy-migrate:

  • 0

The situation is a little bit simplified. I have two migration files for sqlalchemy-migrate:

In First I create table volume_usage_cache, then autoload it, create copy of its columns and print it:

from sqlalchemy import Column, DateTime
from sqlalchemy import Boolean, BigInteger, MetaData, Integer, String, Table

def upgrade(migrate_engine):

    meta = MetaData()
    meta.bind = migrate_engine

    # Create new table
    volume_usage_cache = Table('volume_usage_cache', meta,
        Column('deleted', Boolean(create_constraint=True, name=None)),
        Column('id', Integer(), primary_key=True, nullable=False),
        Column('curr_write_bytes', BigInteger(), default=0),
        mysql_engine='InnoDB',
        mysql_charset='utf8'
    )

    volume_usage_cache.create()
    volume_usage_cache = Table('volume_usage_cache', meta, autoload=True)
    columns = []
    [columns.append(column.copy()) for column in volume_usage_cache.columns]
    print columns

And I get in log what I expected:

[Column('deleted', Boolean(), table=None), Column('id', Integer(), table=None,
primary_key=True, nullable=False), Column('curr_write_bytes', BigInteger(), 
table=None, default=ColumnDefault(0))]

But if I make a copy of columns in Second migration file (that is runed after First):

from sqlalchemy import MetaData, String, Integer, Boolean, Table, Column, Index
def upgrade(migrate_engine):
    meta = MetaData()
    meta.bind = migrate_engine

    table = Table("volume_usage_cache", meta, autoload=True) 
    columns = []
    for column in table.columns:
        columns.append(column.copy())
    print columns

I get a different result:

[Column('deleted', INTEGER(), table=None, default=ColumnDefault(0)), 
Column(u'id', INTEGER(), table=None, primary_key=True, nullable=False), 
Column(u'curr_write_bytes', NullType(), table=None)]

Why curr_write_bytes column has NullType?

  • 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-06-16T05:07:52+00:00Added an answer on June 16, 2026 at 5:07 am

    The are two problems:

    First:
    In First file we are using old metadata that already contains all columns with need types
    So if we create new MetaData instance, SqlAlchemy will load info about table from database and will get the same result as in Second file.


    Second:
    There is no support in sqlAlchemy for BigInteger column type (in sqlite). And Sqlite doesn’t support types of column at all. So we can create table with column BigInteger (and it will work), but after autoload type of such column will be automatically converted to NullType.

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

Sidebar

Related Questions

I am looking for a little bit help on this situation. I have a
A little bit about my current situation: I have a decent knowledge of OOP
I have a little bit of a confusing situation :) I have a JavaScript
Let me describe little bit whats my situation, I have SWT Text in my
I'm in a little bit weird situation. The situation I currently have is typically
There's a little bit uncommon situation in my app, that is, I have to
I will try to explain the situation as it is a little bit more
I have a funny little situation on my hands. I have a httpModule on
I have seen a similar related post but my situation is a little different
I am using knockout.js. I am stuck in a little bit strange situation (

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.